diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-01-11 19:45:20 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-01-11 19:45:20 +0000 |
commit | 6547884b9c20096594bdc652669df82c322c5eb6 (patch) | |
tree | d7ac58268a68c39619f25c6f24d49813b24b6fd3 | |
parent | 5078d46af381b27be1c7e3c3e0c517e4cf7cc064 (diff) |
[analyzer] Support post-visiting ObjCIvarRefExprs for checkers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123263 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def | 1 | ||||
-rw-r--r-- | lib/StaticAnalyzer/Checkers/ExprEngine.cpp | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def b/include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def index f5673c804e..d3912e6010 100644 --- a/include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def +++ b/include/clang/StaticAnalyzer/PathSensitive/CheckerVisitor.def @@ -41,6 +41,7 @@ POSTVISIT(CompoundAssignOperator, BinaryOperator) POSTVISIT(CXXOperatorCallExpr, GenericCall) POSTVISIT(CXXMemberCallExpr, GenericCall) POSTVISIT(ObjCMessageExpr, Stmt) +POSTVISIT(ObjCIvarRefExpr, Stmt) #undef PREVISIT #undef POSTVISIT diff --git a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp index 3f9eb1b451..f19f806423 100644 --- a/lib/StaticAnalyzer/Checkers/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Checkers/ExprEngine.cpp @@ -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); } //===----------------------------------------------------------------------===// |