[cfe-commits] r68685 - in /cfe/trunk: include/clang/Analysis/PathSensitive/SVals.h lib/Analysis/GRExprEngine.cpp lib/Analysis/SVals.cpp

Zhongxing Xu xuzhongxing at gmail.com
Wed Apr 8 22:57:11 PDT 2009


Author: zhongxingxu
Date: Thu Apr  9 00:57:11 2009
New Revision: 68685

URL: http://llvm.org/viewvc/llvm-project?rev=68685&view=rev
Log:
Create a symbolic region instead of a loc::SymbolVal. This is a continued step
to eliminate the use of loc::SymbolVal.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h
    cfe/trunk/lib/Analysis/GRExprEngine.cpp
    cfe/trunk/lib/Analysis/SVals.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h?rev=68685&r1=68684&r2=68685&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/SVals.h Thu Apr  9 00:57:11 2009
@@ -76,8 +76,8 @@
   static SVal GetRValueSymbolVal(SymbolManager& SymMgr, MemRegionManager& MRMgr,
                                  const MemRegion* R);
 
-  static SVal GetConjuredSymbolVal(SymbolManager& SymMgr, const Expr *E,
-                                   unsigned Count);  
+  static SVal GetConjuredSymbolVal(SymbolManager& SymMgr, MemRegionManager&,
+                                   const Expr *E, unsigned Count);  
 
   inline bool isUnknown() const {
     return getRawKind() == UnknownKind;

Modified: cfe/trunk/lib/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngine.cpp?rev=68685&r1=68684&r2=68685&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Thu Apr  9 00:57:11 2009
@@ -2536,7 +2536,8 @@
       
       // Conjure a new symbol if necessary to recover precision.
       if (Result.isUnknown() || !getConstraintManager().canReasonAbout(Result))
-        Result = SVal::GetConjuredSymbolVal(SymMgr, Ex,
+        Result = SVal::GetConjuredSymbolVal(SymMgr, 
+                                       getStoreManager().getRegionManager(),Ex,
                                             Builder->getCurrentBlockCount());
       
       state = BindExpr(state, U, U->isPostfix() ? V2 : Result);

Modified: cfe/trunk/lib/Analysis/SVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/SVals.cpp?rev=68685&r1=68684&r2=68685&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/SVals.cpp (original)
+++ cfe/trunk/lib/Analysis/SVals.cpp Thu Apr  9 00:57:11 2009
@@ -291,26 +291,23 @@
       return Loc::MakeVal(MRMgr.getSymbolicRegion(sym));
   
     // Only handle integers for now.
-    if (T->isIntegerType())
+    if (T->isIntegerType() && T->isScalarType())
       return NonLoc::MakeVal(sym);
   }
 
   return UnknownVal();
 }
 
-SVal SVal::GetConjuredSymbolVal(SymbolManager &SymMgr, const Expr* E,
-                                unsigned Count) {
-
+SVal SVal::GetConjuredSymbolVal(SymbolManager &SymMgr, MemRegionManager& MRMgr,
+                                const Expr* E, unsigned Count) {
   QualType T = E->getType();
-  
-  if (Loc::IsLocType(T)) {
-    SymbolRef Sym = SymMgr.getConjuredSymbol(E, Count);        
-    return loc::SymbolVal(Sym);
-  }
-  else if (T->isIntegerType() && T->isScalarType()) {
-    SymbolRef Sym = SymMgr.getConjuredSymbol(E, Count);        
-    return nonloc::SymbolVal(Sym);                    
-  }
+  SymbolRef sym = SymMgr.getConjuredSymbol(E, Count);
+
+  if (Loc::IsLocType(T))
+    return Loc::MakeVal(MRMgr.getSymbolicRegion(sym));
+
+  if (T->isIntegerType() && T->isScalarType())
+    return NonLoc::MakeVal(sym);
 
   return UnknownVal();
 }





More information about the cfe-commits mailing list