"if(x)". On the true branch we know the value is != 0, and on the false branch
we know it is 0.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46814
91177308-0d34-0410-b5e6-
96231b3b80d8
assert (false && "'Assume' not implemented for this NonLValue.");
return St;
+
+ case nonlval::SymbolValKind: {
+ lval::SymbolVal& SV = cast<lval::SymbolVal>(Cond);
+ SymbolID sym = SV.getSymbol();
+
+ if (Assumption)
+ return AssumeSymNE(St, sym, ValMgr.getValue(0, SymMgr.getType(sym)),
+ isFeasible);
+ else
+ return AssumeSymEQ(St, sym, ValMgr.getValue(0, SymMgr.getType(sym)),
+ isFeasible);
+ }
+
case nonlval::SymIntConstraintValKind:
return
AssumeSymInt(St, Assumption,
return X;
}
+QualType SymbolData::getType() const {
+ switch (getKind()) {
+ default:
+ assert (false && "getType() not implemented for this symbol.");
+
+ case ParmKind:
+ return static_cast<ParmVarDecl*>(getPtr())->getType();
+ }
+}
+
SymbolManager::SymbolManager() {}
SymbolManager::~SymbolManager() {}
inline Kind getKind() const { return (Kind) (Data & Mask); }
inline void* getPtr() const { return reinterpret_cast<void*>(Data & ~Mask); }
- inline bool operator==(const SymbolData& R) const { return Data == R.Data; }
+ inline bool operator==(const SymbolData& R) const { return Data == R.Data; }
+
+ QualType getType() const;
};
SymbolManager();
~SymbolManager();
- SymbolData getSymbolData(SymbolID id) const {
- assert (id < SymbolToData.size());
- return SymbolToData[id];
+ SymbolID getSymbol(ParmVarDecl* D);
+
+ inline SymbolData getSymbolData(SymbolID ID) const {
+ assert (ID < SymbolToData.size());
+ return SymbolToData[ID];
}
- SymbolID getSymbol(ParmVarDecl* D);
+ inline QualType getType(SymbolID ID) const {
+ return getSymbolData(ID).getType();
+ }
};