summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-07-31 16:34:07 +0000
committerJordan Rose <jordan_rose@apple.com>2012-07-31 16:34:07 +0000
commite8a21b73ac5b4d84981fc813db9d8254a45ae477 (patch)
tree0c0ce62049db14cafe4a002ab302b3fe98535002 /clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
parent7b2f36e96aa784d68c9e1f9f12f85ca741c4513a (diff)
downloadbcm5719-llvm-e8a21b73ac5b4d84981fc813db9d8254a45ae477.tar.gz
bcm5719-llvm-e8a21b73ac5b4d84981fc813db9d8254a45ae477.zip
[analyzer] Getting an lvalue for a reference field still requires a load.
This was causing a crash in our array-to-pointer logic, since the region was clearly not an array. PR13440 / <rdar://problem/11977113> llvm-svn: 161051
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngine.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngine.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index a1cd23dc6ba..b46dc49a1bf 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1522,10 +1522,17 @@ void ExprEngine::VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred,
// For all other cases, compute an lvalue.
SVal L = state->getLValue(field, baseExprVal);
- if (M->isGLValue())
+ if (M->isGLValue()) {
+ if (field->getType()->isReferenceType()) {
+ if (const MemRegion *R = L.getAsRegion())
+ L = state->getSVal(R);
+ else
+ L = UnknownVal();
+ }
+
Bldr.generateNode(M, Pred, state->BindExpr(M, LCtx, L), false, 0,
ProgramPoint::PostLValueKind);
- else {
+ } else {
Bldr.takeNodes(Pred);
evalLoad(Dst, M, M, Pred, state, L);
Bldr.addNodes(Dst);
OpenPOWER on IntegriCloud