Add a QualType to ConjuredSymbol to represent the type and size of the symbol.
Use this updated interface when invalidating arguments passed by reference; the type of symbol is of the object passed by reference, not the reference itself. llvm-svn: 56894
This commit is contained in:
parent
15e6be8cc5
commit
d331d09e2f
@ -167,25 +167,29 @@ public:
|
||||
|
||||
class SymbolConjured : public SymbolData {
|
||||
Expr* E;
|
||||
QualType T;
|
||||
unsigned Count;
|
||||
|
||||
public:
|
||||
SymbolConjured(SymbolID Sym, Expr* exp, unsigned count)
|
||||
: SymbolData(ConjuredKind, Sym), E(exp), Count(count) {}
|
||||
SymbolConjured(SymbolID Sym, Expr* exp, QualType t, unsigned count)
|
||||
: SymbolData(ConjuredKind, Sym), E(exp), T(t), Count(count) {}
|
||||
|
||||
Expr* getExpr() const { return E; }
|
||||
unsigned getCount() const { return Count; }
|
||||
|
||||
QualType getType() const { return T; }
|
||||
|
||||
static void Profile(llvm::FoldingSetNodeID& profile,
|
||||
Expr* E, unsigned Count) {
|
||||
Expr* E, QualType T, unsigned Count) {
|
||||
|
||||
profile.AddInteger((unsigned) ConjuredKind);
|
||||
profile.AddPointer(E);
|
||||
profile.Add(T);
|
||||
profile.AddInteger(Count);
|
||||
}
|
||||
|
||||
virtual void Profile(llvm::FoldingSetNodeID& profile) {
|
||||
Profile(profile, E, Count);
|
||||
Profile(profile, E, T, Count);
|
||||
}
|
||||
|
||||
// Implement isa<T> support.
|
||||
@ -243,7 +247,10 @@ public:
|
||||
|
||||
SymbolID getSymbol(VarDecl* D);
|
||||
SymbolID getContentsOfSymbol(SymbolID sym);
|
||||
SymbolID getConjuredSymbol(Expr* E, unsigned VisitCount);
|
||||
SymbolID getConjuredSymbol(Expr* E, QualType T, unsigned VisitCount);
|
||||
SymbolID getConjuredSymbol(Expr* E, unsigned VisitCount) {
|
||||
return getConjuredSymbol(E, E->getType(), VisitCount);
|
||||
}
|
||||
|
||||
const SymbolData& getSymbolData(SymbolID ID) const;
|
||||
|
||||
|
||||
@ -1515,7 +1515,9 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst,
|
||||
|
||||
// Set the value of the variable to be a conjured symbol.
|
||||
unsigned Count = Builder.getCurrentBlockCount();
|
||||
SymbolID NewSym = Eng.getSymbolManager().getConjuredSymbol(*I, Count);
|
||||
SymbolID NewSym =
|
||||
Eng.getSymbolManager().getConjuredSymbol(*I, DV->getDecl()->getType(),
|
||||
Count);
|
||||
|
||||
state = state.SetRVal(*DV,
|
||||
LVal::IsLValType(DV->getDecl()->getType())
|
||||
|
||||
@ -1702,10 +1702,12 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred,
|
||||
break;
|
||||
|
||||
case UnaryOperator::Not:
|
||||
// FIXME: Do we need to handle promotions?
|
||||
St = SetRVal(St, U, EvalComplement(cast<NonLVal>(V)));
|
||||
break;
|
||||
|
||||
case UnaryOperator::Minus:
|
||||
// FIXME: Do we need to handle promotions?
|
||||
St = SetRVal(St, U, EvalMinus(U, cast<NonLVal>(V)));
|
||||
break;
|
||||
|
||||
|
||||
@ -73,10 +73,10 @@ SymbolID SymbolManager::getContentsOfSymbol(SymbolID sym) {
|
||||
return SymbolCounter++;
|
||||
}
|
||||
|
||||
SymbolID SymbolManager::getConjuredSymbol(Expr* E, unsigned Count) {
|
||||
SymbolID SymbolManager::getConjuredSymbol(Expr* E, QualType T, unsigned Count) {
|
||||
|
||||
llvm::FoldingSetNodeID profile;
|
||||
SymbolConjured::Profile(profile, E, Count);
|
||||
SymbolConjured::Profile(profile, E, T, Count);
|
||||
void* InsertPos;
|
||||
|
||||
SymbolData* SD = DataSet.FindNodeOrInsertPos(profile, InsertPos);
|
||||
@ -85,7 +85,7 @@ SymbolID SymbolManager::getConjuredSymbol(Expr* E, unsigned Count) {
|
||||
return SD->getSymbol();
|
||||
|
||||
SD = (SymbolData*) BPAlloc.Allocate<SymbolConjured>();
|
||||
new (SD) SymbolConjured(SymbolCounter, E, Count);
|
||||
new (SD) SymbolConjured(SymbolCounter, E, T, Count);
|
||||
|
||||
DataSet.InsertNode(SD, InsertPos);
|
||||
DataMap[SymbolCounter] = SD;
|
||||
@ -118,7 +118,7 @@ QualType SymbolData::getType(const SymbolManager& SymMgr) const {
|
||||
}
|
||||
|
||||
case ConjuredKind:
|
||||
return cast<SymbolConjured>(this)->getExpr()->getType();
|
||||
return cast<SymbolConjured>(this)->getType();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user