summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/GRExprEngine.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-30 22:17:15 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-30 22:17:15 +0000
commita16dacb6aabe345dba0a1ea1561db9eb4181aff3 (patch)
treed395b1ffdce64fbdd4b018ec62d00be93fb2ed69 /clang/lib/Analysis/GRExprEngine.cpp
parentca67cab1e8f3e41c4015e8bc85066754b5b2fb38 (diff)
downloadbcm5719-llvm-a16dacb6aabe345dba0a1ea1561db9eb4181aff3.tar.gz
bcm5719-llvm-a16dacb6aabe345dba0a1ea1561db9eb4181aff3.zip
Add placeholder code in the static analyzer for MemberExprs involving struct temporaries.
llvm-svn: 50502
Diffstat (limited to 'clang/lib/Analysis/GRExprEngine.cpp')
-rw-r--r--clang/lib/Analysis/GRExprEngine.cpp55
1 files changed, 45 insertions, 10 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp
index 7bfcaab1121..e10e9ae8f39 100644
--- a/clang/lib/Analysis/GRExprEngine.cpp
+++ b/clang/lib/Analysis/GRExprEngine.cpp
@@ -831,22 +831,57 @@ void GRExprEngine::VisitMemberExpr(MemberExpr* M, NodeTy* Pred,
// abstract address of the base object.
NodeSet Tmp;
- if (IsPointerType(Base->getType())) // Base always is an LVal.
- Visit(Base, Pred, Tmp);
- else
- VisitLVal(Base, Pred, Tmp);
+ if (asLVal) {
+
+ if (IsPointerType(Base->getType())) // Base always is an LVal.
+ Visit(Base, Pred, Tmp);
+ else
+ VisitLVal(Base, Pred, Tmp);
+
+ for (NodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
+ ValueState* St = GetState(*I);
+ RVal BaseV = GetRVal(St, Base);
+
+ RVal V = lval::FieldOffset::Make(BasicVals, GetRVal(St, Base),
+ M->getMemberDecl());
+
+ MakeNode(Dst, M, *I, SetRVal(St, M, V));
+ }
+
+ return;
+ }
+
+ // Evaluate the base. Can be an LVal or NonLVal (depends on whether
+ // or not isArrow() is true).
+ Visit(Base, Pred, Tmp);
for (NodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
+
ValueState* St = GetState(*I);
- RVal BaseV = GetRVal(St, Base);
+ RVal BaseV = GetRVal(St, Base);
- RVal V = lval::FieldOffset::Make(BasicVals, GetRVal(St, Base),
- M->getMemberDecl());
+ if (IsPointerType(Base->getType())) {
+
+ assert (M->isArrow());
+
+ RVal V = lval::FieldOffset::Make(BasicVals, GetRVal(St, Base),
+ M->getMemberDecl());
- if (asLVal)
- MakeNode(Dst, M, *I, SetRVal(St, M, V));
- else
EvalLoad(Dst, M, *I, St, V);
+ }
+ else {
+
+ assert (!M->isArrow());
+
+ if (BaseV.isUnknownOrUndef()) {
+ MakeNode(Dst, M, *I, SetRVal(St, M, BaseV));
+ continue;
+ }
+
+ // FIXME: Implement nonlval objects representing struct temporaries.
+ assert (isa<NonLVal>(BaseV));
+ MakeNode(Dst, M, *I, SetRVal(St, M, UnknownVal()));
+ }
}
}
OpenPOWER on IntegriCloud