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/include/clang/Analysis/PathSensitive/SVals.h b/include/clang/Analysis/PathSensitive/SVals.h
index 6667f93..9d9d9d8 100644
--- a/include/clang/Analysis/PathSensitive/SVals.h
+++ b/include/clang/Analysis/PathSensitive/SVals.h
@@ -78,6 +78,8 @@
 
   static SVal GetConjuredSymbolVal(SymbolManager& SymMgr, MemRegionManager&,
                                    const Expr *E, unsigned Count);  
+  static SVal GetConjuredSymbolVal(SymbolManager &SymMgr, MemRegionManager&,
+                                   const Expr* E, QualType T, unsigned Count);
 
   inline bool isUnknown() const {
     return getRawKind() == UnknownKind;
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));