[cfe-commits] r47970 - in /cfe/trunk: Analysis/GRExprEngine.cpp include/clang/Analysis/PathSensitive/GRCoreEngine.h

Ted Kremenek kremenek at apple.com
Wed Mar 5 16:49:16 CST 2008


Author: kremenek
Date: Wed Mar  5 16:49:16 2008
New Revision: 47970

URL: http://llvm.org/viewvc/llvm-project?rev=47970&view=rev
Log:
Small bug fix when handling CallExprs that generate sink nodes.

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

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

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Wed Mar  5 16:49:16 2008
@@ -501,17 +501,8 @@
     SaveAndRestore<bool> OldSink(Builder->BuildSinks);
     
     if (isa<lval::FuncVal>(L))
-      if (cast<lval::FuncVal>(L).getDecl()->getAttr<NoReturnAttr>()) {
-        for (NodeSet::iterator I=Dst.begin(), E=Dst.end(); I != E; ++I ) {
-          
-          NodeTy* N = *I;
-          
-          if (!N->isSink())
-            N->markAsSink();
-        }
-        
+      if (cast<lval::FuncVal>(L).getDecl()->getAttr<NoReturnAttr>())
         Builder->BuildSinks = true;
-      }
     
     // Evaluate the call.
     
@@ -573,7 +564,7 @@
       
       EvalCall(Dst, CE, cast<LVal>(L), *DI);
       
-      if (Dst.size() == size)
+      if (!Builder->BuildSinks && Dst.size() == size)
         Nodify(Dst, CE, *DI, St);
     }
   }

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRCoreEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRCoreEngine.h Wed Mar  5 16:49:16 2008
@@ -177,20 +177,23 @@
   }
   
   NodeTy* Nodify(ExplodedNodeSet<StateTy>& Dst, Stmt* S,
-                 NodeTy* Pred, StateTy* St) {
+                 NodeTy* Pred, StateTy* St) {    
+    
     
     // If the state hasn't changed, don't generate a new node.
-    if (St == Pred->getState()) {
+    if (!BuildSinks && St == Pred->getState()) {
       Dst.Add(Pred);
       return NULL;
     }
     
     NodeTy* N = generateNode(S, St, Pred);
     
-    if (N && BuildSinks)
-      N->markAsSink();
-    else
-      Dst.Add(N);
+    if (N) {      
+      if (BuildSinks)
+        N->markAsSink();
+      else
+        Dst.Add(N);
+    }
     
     return N;
   }




More information about the cfe-commits mailing list