]> granicus.if.org Git - clang/commitdiff
[analyzer] Support post-visiting ObjCIvarRefExprs for checkers.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 11 Jan 2011 19:45:20 +0000 (19:45 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 11 Jan 2011 19:45:20 +0000 (19:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123263 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def
lib/StaticAnalyzer/Checkers/ExprEngine.cpp

index f5673c804e1bc97bc44bb3ebe97eb61ae40d9fa1..d3912e6010b85b9c8d05774d531be614bce4d989 100644 (file)
@@ -41,6 +41,7 @@ POSTVISIT(CompoundAssignOperator, BinaryOperator)
 POSTVISIT(CXXOperatorCallExpr, GenericCall)
 POSTVISIT(CXXMemberCallExpr, GenericCall)
 POSTVISIT(ObjCMessageExpr, Stmt)
+POSTVISIT(ObjCIvarRefExpr, Stmt)
 
 #undef PREVISIT
 #undef POSTVISIT
index 3f9eb1b451e6ee9c8595303296f8eb512d818601..f19f806423ed9273abf1c4334c429631cf52eca2 100644 (file)
@@ -2070,6 +2070,8 @@ void ExprEngine::VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr* Ex,
   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 @@ void ExprEngine::VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr* Ex,
     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);
 }
 
 //===----------------------------------------------------------------------===//