Add a new method because sometimes the type of the conjured symbol is not the
type of the expression where we create the symbol.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68692 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 9f48fff..5d1834f 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1761,7 +1761,7 @@
if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())){
SVal V = SVal::GetConjuredSymbolVal(Eng.getSymbolManager(),
- Eng.getStoreManager().getRegionManager(), *I, Count);
+ Eng.getStoreManager().getRegionManager(), *I, T, Count);
state = state.BindLoc(Loc::MakeVal(R), V);
}
else if (const RecordType *RT = T->getAsStructureType()) {
diff --git a/lib/Analysis/SVals.cpp b/lib/Analysis/SVals.cpp
index cf3e800..ddb2da6 100644
--- a/lib/Analysis/SVals.cpp
+++ b/lib/Analysis/SVals.cpp
@@ -312,6 +312,19 @@
return UnknownVal();
}
+SVal SVal::GetConjuredSymbolVal(SymbolManager &SymMgr, MemRegionManager& MRMgr,
+ const Expr* E, QualType T, unsigned Count) {
+ SymbolRef sym = SymMgr.getConjuredSymbol(E, T, Count);
+
+ if (Loc::IsLocType(T))
+ return Loc::MakeVal(MRMgr.getSymbolicRegion(sym));
+
+ if (T->isIntegerType() && T->isScalarType())
+ return NonLoc::MakeVal(sym);
+
+ return UnknownVal();
+}
+
nonloc::LocAsInteger nonloc::LocAsInteger::Make(BasicValueFactory& Vals, Loc V,
unsigned Bits) {
return LocAsInteger(Vals.getPersistentSValWithData(V, Bits));