aboutsummaryrefslogtreecommitdiffstats
path: root/support/lib/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-08-27 05:19:10 +0000
committerChris Lattner <sabre@nondot.org>2001-08-27 05:19:10 +0000
commitda8f004cdbf268d4906f0e42e21b76f1da6beb91 (patch)
treea6da3a7b4aacf8f6588b6b012cb79e2a91610d95 /support/lib/Support
parentbe88fd03e6d2d9eb8ce570031ce011cb5a6bfd35 (diff)
downloadexternal_llvm-da8f004cdbf268d4906f0e42e21b76f1da6beb91.zip
external_llvm-da8f004cdbf268d4906f0e42e21b76f1da6beb91.tar.gz
external_llvm-da8f004cdbf268d4906f0e42e21b76f1da6beb91.tar.bz2
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
Diffstat (limited to 'support/lib/Support')
-rw-r--r--support/lib/Support/Annotation.cpp11
1 files changed, 6 insertions, 5 deletions
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<unsigned, AnnFactory> FactMapType;
+typedef Annotation *(*AnnFactory)(AnnotationID, Annotable *, void *);
+typedef map<unsigned, pair<AnnFactory,void*> > 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);
}