From da8f004cdbf268d4906f0e42e21b76f1da6beb91 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 27 Aug 2001 05:19:10 +0000 Subject: Support passing a data pointer to annotation factory methods git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@376 91177308-0d34-0410-b5e6-96231b3b80d8 --- support/lib/Support/Annotation.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'support/lib/Support') diff --git a/support/lib/Support/Annotation.cpp b/support/lib/Support/Annotation.cpp index 735d01b..e986620 100644 --- a/support/lib/Support/Annotation.cpp +++ b/support/lib/Support/Annotation.cpp @@ -14,8 +14,8 @@ static unsigned IDCounter = 0; // Unique ID counter static IDMapType &getIDMap() { static IDMapType TheMap; return TheMap; } // On demand annotation creation support... -typedef Annotation *(*AnnFactory)(AnnotationID, Annotable *); -typedef map FactMapType; +typedef Annotation *(*AnnFactory)(AnnotationID, Annotable *, void *); +typedef map > FactMapType; static FactMapType &getFactMap() { static FactMapType FactMap; return FactMap; } @@ -45,9 +45,10 @@ const string &AnnotationManager::getName(AnnotationID ID) { // ID -> Name // Annotable::findOrCreateAnnotation method. // void AnnotationManager::registerAnnotationFactory(AnnotationID ID, - AnnFactory F) { + AnnFactory F, + void *ExtraData) { if (F) - getFactMap()[ID.ID] = F; + getFactMap()[ID.ID] = make_pair(F, ExtraData); else getFactMap().erase(ID.ID); } @@ -59,5 +60,5 @@ Annotation *AnnotationManager::createAnnotation(AnnotationID ID, Annotable *Obj) { FactMapType::iterator I = getFactMap().find(ID.ID); if (I == getFactMap().end()) return 0; - return I->second(ID, Obj); + return I->second.first(ID, Obj, I->second.second); } -- cgit v1.1