[cfe-commits] r123263 - in /cfe/trunk: include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def lib/StaticAnalyzer/Checkers/ExprEngine.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Tue Jan 11 11:45:20 PST 2011


Author: akirtzidis
Date: Tue Jan 11 13:45:20 2011
New Revision: 123263

URL: http://llvm.org/viewvc/llvm-project?rev=123263&view=rev
Log:
[analyzer] Support post-visiting ObjCIvarRefExprs for checkers.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def
    cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def?rev=123263&r1=123262&r2=123263&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def Tue Jan 11 13:45:20 2011
@@ -41,6 +41,7 @@
 POSTVISIT(CXXOperatorCallExpr, GenericCall)
 POSTVISIT(CXXMemberCallExpr, GenericCall)
 POSTVISIT(ObjCMessageExpr, Stmt)
+POSTVISIT(ObjCIvarRefExpr, Stmt)
 
 #undef PREVISIT
 #undef POSTVISIT

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp?rev=123263&r1=123262&r2=123263&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/ExprEngine.cpp Tue Jan 11 13:45:20 2011
@@ -2070,6 +2070,8 @@
   const Expr *baseExpr = Ex->getBase();
   Visit(baseExpr, Pred, dstBase);
 
+  ExplodedNodeSet dstIvar;
+
   // Using the base, compute the lvalue of the instance variable.
   for (ExplodedNodeSet::iterator I = dstBase.begin(), E = dstBase.end();
        I!=E; ++I) {
@@ -2077,8 +2079,12 @@
     const GRState *state = GetState(nodeBase);
     SVal baseVal = state->getSVal(baseExpr);
     SVal location = state->getLValue(Ex->getDecl(), baseVal);
-    MakeNode(Dst, Ex, *I, state->BindExpr(Ex, location));
+    MakeNode(dstIvar, Ex, *I, state->BindExpr(Ex, location));
   }
+
+  // Perform the post-condition check of the ObjCIvarRefExpr and store
+  // the created nodes in 'Dst'.
+  CheckerVisit(Ex, Dst, dstIvar, PostVisitStmtCallback);
 }
 
 //===----------------------------------------------------------------------===//





More information about the cfe-commits mailing list