[cfe-commits] r47466 - in /cfe/trunk: Analysis/GRExprEngine.cpp Analysis/GRSimpleVals.cpp include/clang/Analysis/PathSensitive/RValues.h

Ted Kremenek kremenek at apple.com
Thu Feb 21 16:54:56 PST 2008


Author: kremenek
Date: Thu Feb 21 18:54:56 2008
New Revision: 47466

URL: http://llvm.org/viewvc/llvm-project?rev=47466&view=rev
Log:
Added "assumption" logic for lval::FuncVal and lval::GotoLabel, and simplified
assumption logic for lval::DeclVal.

Modified:
    cfe/trunk/Analysis/GRExprEngine.cpp
    cfe/trunk/Analysis/GRSimpleVals.cpp
    cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h

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

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Thu Feb 21 18:54:56 2008
@@ -1155,6 +1155,8 @@
       
       
     case lval::DeclValKind:
+    case lval::FuncValKind:
+    case lval::GotoLabelKind:
       isFeasible = Assumption;
       return St;
 

Modified: cfe/trunk/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.cpp?rev=47466&r1=47465&r2=47466&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/Analysis/GRSimpleVals.cpp Thu Feb 21 18:54:56 2008
@@ -233,13 +233,9 @@
     }
       
     case lval::DeclValKind:
-    
-      if (isa<lval::DeclVal>(R)) {        
-        bool b = cast<lval::DeclVal>(L) == cast<lval::DeclVal>(R);
-        return NonLVal::MakeIntTruthVal(ValMgr, b);
-      }
-    
-      break;
+    case lval::FuncValKind:
+    case lval::GotoLabelKind:
+      return NonLVal::MakeIntTruthVal(ValMgr, L == R);
   }
   
   return NonLVal::MakeIntTruthVal(ValMgr, false);
@@ -288,12 +284,9 @@
     }
       
     case lval::DeclValKind:
-      if (isa<lval::DeclVal>(R)) {        
-        bool b = cast<lval::DeclVal>(L) == cast<lval::DeclVal>(R);
-        return NonLVal::MakeIntTruthVal(ValMgr, b);
-      }
-    
-    break;
+    case lval::FuncValKind:
+    case lval::GotoLabelKind:
+      return NonLVal::MakeIntTruthVal(ValMgr, L != R);
   }
   
   return NonLVal::MakeIntTruthVal(ValMgr, true);

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h Thu Feb 21 18:54:56 2008
@@ -60,6 +60,11 @@
     return getRawKind() == R.getRawKind() && Data == R.Data;
   }
   
+  
+  inline bool operator!=(const RVal& R) const {
+    return !(*this == R);
+  }
+  
   static RVal GetSymbolValue(SymbolManager& SymMgr, ParmVarDecl *D);
   
   inline bool isUnknown() const {





More information about the cfe-commits mailing list