mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
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
This commit is contained in:
parent
be88fd03e6
commit
da8f004cdb
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user