Add an optional "tag" to conjured symbols that allows us to distinguish between
multiple symbols conjured at the same location. All that is required of the tag is that it is a fixed void* value that points to an memory address that remains valid throughout the remainder of the lifetime of the SymbolManager. llvm-svn: 66092
This commit is contained in:
parent
2d33d6300c
commit
6ee8f8bcb5
|
|
@ -139,28 +139,33 @@ class SymbolConjured : public SymbolData {
|
||||||
Stmt* S;
|
Stmt* S;
|
||||||
QualType T;
|
QualType T;
|
||||||
unsigned Count;
|
unsigned Count;
|
||||||
|
const void* SymbolTag;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SymbolConjured(SymbolRef Sym, Stmt* s, QualType t, unsigned count)
|
SymbolConjured(SymbolRef Sym, Stmt* s, QualType t, unsigned count,
|
||||||
: SymbolData(ConjuredKind, Sym), S(s), T(t), Count(count) {}
|
const void* symbolTag)
|
||||||
|
: SymbolData(ConjuredKind, Sym), S(s), T(t), Count(count),
|
||||||
|
SymbolTag(symbolTag) {}
|
||||||
|
|
||||||
Stmt* getStmt() const { return S; }
|
Stmt* getStmt() const { return S; }
|
||||||
unsigned getCount() const { return Count; }
|
unsigned getCount() const { return Count; }
|
||||||
|
const void* getTag() const { return SymbolTag; }
|
||||||
|
|
||||||
QualType getType(ASTContext&) const;
|
QualType getType(ASTContext&) const;
|
||||||
|
|
||||||
static void Profile(llvm::FoldingSetNodeID& profile,
|
static void Profile(llvm::FoldingSetNodeID& profile, Stmt* S, QualType T,
|
||||||
Stmt* S, QualType T, unsigned Count) {
|
unsigned Count, const void* SymbolTag) {
|
||||||
|
|
||||||
profile.AddInteger((unsigned) ConjuredKind);
|
profile.AddInteger((unsigned) ConjuredKind);
|
||||||
profile.AddPointer(S);
|
profile.AddPointer(S);
|
||||||
profile.Add(T);
|
profile.Add(T);
|
||||||
profile.AddInteger(Count);
|
profile.AddInteger(Count);
|
||||||
|
profile.AddPointer(SymbolTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Profile(llvm::FoldingSetNodeID& profile) {
|
virtual void Profile(llvm::FoldingSetNodeID& profile) {
|
||||||
Profile(profile, S, T, Count);
|
Profile(profile, S, T, Count, SymbolTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement isa<T> support.
|
// Implement isa<T> support.
|
||||||
static inline bool classof(const SymbolData* D) {
|
static inline bool classof(const SymbolData* D) {
|
||||||
return D->getKind() == ConjuredKind;
|
return D->getKind() == ConjuredKind;
|
||||||
|
|
@ -217,9 +222,12 @@ public:
|
||||||
|
|
||||||
/// Make a unique symbol for MemRegion R according to its kind.
|
/// Make a unique symbol for MemRegion R according to its kind.
|
||||||
SymbolRef getRegionRValueSymbol(const MemRegion* R);
|
SymbolRef getRegionRValueSymbol(const MemRegion* R);
|
||||||
SymbolRef getConjuredSymbol(Stmt* E, QualType T, unsigned VisitCount);
|
SymbolRef getConjuredSymbol(Stmt* E, QualType T, unsigned VisitCount,
|
||||||
SymbolRef getConjuredSymbol(Expr* E, unsigned VisitCount) {
|
const void* SymbolTag = 0);
|
||||||
return getConjuredSymbol(E, E->getType(), VisitCount);
|
|
||||||
|
SymbolRef getConjuredSymbol(Expr* E, unsigned VisitCount,
|
||||||
|
const void* SymbolTag = 0) {
|
||||||
|
return getConjuredSymbol(E, E->getType(), VisitCount, SymbolTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SymbolData& getSymbolData(SymbolRef ID) const;
|
const SymbolData& getSymbolData(SymbolRef ID) const;
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,11 @@ SymbolRef SymbolManager::getRegionRValueSymbol(const MemRegion* R) {
|
||||||
return SymbolCounter++;
|
return SymbolCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
SymbolRef SymbolManager::getConjuredSymbol(Stmt* E, QualType T, unsigned Count){
|
SymbolRef SymbolManager::getConjuredSymbol(Stmt* E, QualType T, unsigned Count,
|
||||||
|
const void* SymbolTag) {
|
||||||
|
|
||||||
llvm::FoldingSetNodeID profile;
|
llvm::FoldingSetNodeID profile;
|
||||||
SymbolConjured::Profile(profile, E, T, Count);
|
SymbolConjured::Profile(profile, E, T, Count, SymbolTag);
|
||||||
void* InsertPos;
|
void* InsertPos;
|
||||||
|
|
||||||
SymbolData* SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
|
SymbolData* SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
|
||||||
|
|
@ -64,7 +65,7 @@ SymbolRef SymbolManager::getConjuredSymbol(Stmt* E, QualType T, unsigned Count){
|
||||||
return SD->getSymbol();
|
return SD->getSymbol();
|
||||||
|
|
||||||
SD = (SymbolData*) BPAlloc.Allocate<SymbolConjured>();
|
SD = (SymbolData*) BPAlloc.Allocate<SymbolConjured>();
|
||||||
new (SD) SymbolConjured(SymbolCounter, E, T, Count);
|
new (SD) SymbolConjured(SymbolCounter, E, T, Count, SymbolTag);
|
||||||
|
|
||||||
DataSet.InsertNode(SD, InsertPos);
|
DataSet.InsertNode(SD, InsertPos);
|
||||||
DataMap[SymbolCounter] = SD;
|
DataMap[SymbolCounter] = SD;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue