[cfe-commits] r47620 - in /cfe/trunk/Analysis: GRExprEngine.cpp ValueState.cpp

Ted Kremenek kremenek at apple.com
Tue Feb 26 11:40:46 PST 2008


Author: kremenek
Date: Tue Feb 26 13:40:44 2008
New Revision: 47620

URL: http://llvm.org/viewvc/llvm-project?rev=47620&view=rev
Log:
Small fixes to shore up overhauling of transfer function logic for '&&' and '||.

Modified:
    cfe/trunk/Analysis/GRExprEngine.cpp
    cfe/trunk/Analysis/ValueState.cpp

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

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Tue Feb 26 13:40:44 2008
@@ -148,8 +148,8 @@
       break;
 
     case RVal::UnknownKind:
-      builder.generateNode(PrevState, true);
-      builder.generateNode(PrevState, false);
+      builder.generateNode(MarkBranch(PrevState, Term, true), true);
+      builder.generateNode(MarkBranch(PrevState, Term, false), false);
       return;
       
     case RVal::UninitializedKind: {      
@@ -368,6 +368,13 @@
     
     X = GetBlkExprRVal(St, Ex);
     
+    // Handle uninitialized values.
+    
+    if (X.isUninit()) {
+      Nodify(Dst, B, Pred, SetBlkExprRVal(St, B, X));
+      return;
+    }
+    
     // We took the RHS.  Because the value of the '&&' or '||' expression must
     // evaluate to 0 or 1, we must assume the value of the RHS evaluates to 0
     // or 1.  Alternatively, we could take a lazy approach, and calculate this

Modified: cfe/trunk/Analysis/ValueState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/ValueState.cpp?rev=47620&r1=47619&r2=47620&view=diff

==============================================================================
--- cfe/trunk/Analysis/ValueState.cpp (original)
+++ cfe/trunk/Analysis/ValueState.cpp Tue Feb 26 13:40:44 2008
@@ -336,12 +336,16 @@
   
   ValueState::ExprBindingsTy::TreeTy* T = St->SubExprBindings.SlimFind(E);
   
-  return T ? T->getValue().second : GetBlkExprRVal(St, E);
+  if (T)
+    return T->getValue().second;
+  
+  T = St->BlockExprBindings.SlimFind(E);
+  return T ? T->getValue().second : UnknownVal();
 }
 
 RVal ValueStateManager::GetBlkExprRVal(ValueState St, Expr* E) {
   
-  assert (!isa<ParenExpr>(E));
+  E = E->IgnoreParens();
   
   switch (E->getStmtClass()) {
     case Stmt::CharacterLiteralClass: {





More information about the cfe-commits mailing list