summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-09-29 01:36:51 +0000
committerJordan Rose <jordan_rose@apple.com>2012-09-29 01:36:51 +0000
commitd60b9168fa14b091a9e89f38484b64e57e1e5ece (patch)
tree8bef05a5ee0df80cc2cb9e4c049da9e2692d236d /clang/lib/StaticAnalyzer
parentd9b0268401840e1ad82df65af288e5a0a63da120 (diff)
downloadbcm5719-llvm-d60b9168fa14b091a9e89f38484b64e57e1e5ece.tar.gz
bcm5719-llvm-d60b9168fa14b091a9e89f38484b64e57e1e5ece.zip
Revert "[analyzer] Create a temporary region for rvalue structs when accessing fields"
This reverts commit 6f61df3e7256413dcb99afb9673f4206e3c4992c. llvm-svn: 164877
Diffstat (limited to 'clang/lib/StaticAnalyzer')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngine.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 06216f83ea9..8e2c159ca7d 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1505,17 +1505,17 @@ void ExprEngine::VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred,
ProgramStateRef state = Pred->getState();
const LocationContext *LCtx = Pred->getLocationContext();
SVal baseExprVal = state->getSVal(baseExpr, Pred->getLocationContext());
-
- // If we're accessing a field of an rvalue, we need to treat it like a
- // temporary object.
- if (isa<NonLoc>(baseExprVal)) {
- const MemRegion *R =
- svalBuilder.getRegionManager().getCXXTempObjectRegion(baseExpr, LCtx);
- SVal L = loc::MemRegionVal(R);
- state = state->bindLoc(L, baseExprVal);
- baseExprVal = L;
+ if (isa<nonloc::LazyCompoundVal>(baseExprVal) ||
+ isa<nonloc::CompoundVal>(baseExprVal) ||
+ // FIXME: This can originate by conjuring a symbol for an unknown
+ // temporary struct object, see test/Analysis/fields.c:
+ // (p = getit()).x
+ isa<nonloc::SymbolVal>(baseExprVal)) {
+ Bldr.generateNode(M, Pred, state->BindExpr(M, LCtx, UnknownVal()));
+ return;
}
+ // For all other cases, compute an lvalue.
SVal L = state->getLValue(field, baseExprVal);
if (M->isGLValue()) {
ExplodedNodeSet Tmp;
OpenPOWER on IntegriCloud