[analyzer] Handle reads of ObjCPropertyRefExprs implicitly in Environment. No need to bind an explicit value and create a new node.

llvm-svn: 138196
This commit is contained in:
Ted Kremenek 2011-08-20 06:23:25 +00:00
parent 876e34b7b5
commit 60d2ec5765
4 changed files with 6 additions and 10 deletions

View File

@ -298,9 +298,6 @@ public:
void VisitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt *S,
ExplodedNode *Pred, ExplodedNodeSet &Dst);
void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *E,
ExplodedNode *Pred, ExplodedNodeSet &Dst);
/// Transfer function logic for computing the lvalue of an Objective-C ivar.
void VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr *DR, ExplodedNode *Pred,
ExplodedNodeSet &Dst);

View File

@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
#include "clang/AST/ExprObjC.h"
#include "clang/Analysis/AnalysisContext.h"
#include "clang/Analysis/CFG.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
@ -83,6 +84,9 @@ SVal Environment::getSVal(const Stmt *E, SValBuilder& svalBuilder,
case Stmt::CXXBindTemporaryExprClass:
E = cast<CXXBindTemporaryExpr>(E)->getSubExpr();
continue;
case Stmt::ObjCPropertyRefExprClass:
return loc::ObjCPropRef(cast<ObjCPropertyRefExpr>(E));
// Handle all other Stmt* using a lookup.
default:
break;

View File

@ -540,7 +540,8 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred,
break;
case Stmt::ObjCPropertyRefExprClass:
VisitObjCPropertyRefExpr(cast<ObjCPropertyRefExpr>(S), Pred, Dst);
// Implicitly handled by Environment::getSVal().
Dst.Add(Pred);
break;
case Stmt::ImplicitValueInitExprClass: {

View File

@ -237,9 +237,3 @@ void ExprEngine::VisitObjCMessage(const ObjCMessage &msg,
// the created nodes in 'Dst'.
getCheckerManager().runCheckersForPostObjCMessage(Dst, dstEval, msg, *this);
}
void ExprEngine::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Ex,
ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
MakeNode(Dst, Ex, Pred, Pred->getState()->BindExpr(Ex, loc::ObjCPropRef(Ex)));
}