summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-10-01 19:07:22 +0000
committerJordan Rose <jordan_rose@apple.com>2012-10-01 19:07:22 +0000
commit92375adafbca9ee5dc2840a6252000154a6e71df (patch)
treefdf22c6e64d913cf14f809162cabc1b1ab07d2b2 /clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
parent28c06b268eb2db0ba5df054279da9dc2f7e018e9 (diff)
downloadbcm5719-llvm-92375adafbca9ee5dc2840a6252000154a6e71df.tar.gz
bcm5719-llvm-92375adafbca9ee5dc2840a6252000154a6e71df.zip
[analyzer] Allow ObjC ivar lvalues where the base is nil.
By analogy with C structs, this seems to be legal, if probably discouraged. It's only if the ivar is read from or written to that there's a problem. Running a program that gets the "address" of an instance variable does in fact return the offset when the base "object" is nil. This isn't a full revert because r164442 includes some diagnostic tweaks as well; those have been kept. This partially reverts r164442 / 08965091770c9b276c238bac2f716eaa4da2dca4. llvm-svn: 164960
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
index ee315a4604a..51dda19b531 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
@@ -25,21 +25,11 @@ void ExprEngine::VisitLvalObjCIvarRefExpr(const ObjCIvarRefExpr *Ex,
ProgramStateRef state = Pred->getState();
const LocationContext *LCtx = Pred->getLocationContext();
SVal baseVal = state->getSVal(Ex->getBase(), LCtx);
-
- // First check that the base object is valid.
- ExplodedNodeSet DstLoc;
- evalLocation(DstLoc, Ex, Ex, Pred, state, baseVal,
- /*Tag=*/0, /*isLoad=*/true);
-
- // Bind the lvalue to the expression.
SVal location = state->getLValue(Ex->getDecl(), baseVal);
ExplodedNodeSet dstIvar;
- StmtNodeBuilder Bldr(DstLoc, dstIvar, *currBldrCtx);
- for (ExplodedNodeSet::iterator I = DstLoc.begin(), E = DstLoc.end();
- I != E; ++I) {
- Bldr.generateNode(Ex, (*I), (*I)->getState()->BindExpr(Ex, LCtx, location));
- }
+ StmtNodeBuilder Bldr(Pred, dstIvar, *currBldrCtx);
+ Bldr.generateNode(Ex, Pred, state->BindExpr(Ex, LCtx, location));
// Perform the post-condition check of the ObjCIvarRefExpr and store
// the created nodes in 'Dst'.
OpenPOWER on IntegriCloud