aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/Environment.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2010-12-22 07:20:27 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2010-12-22 07:20:27 +0000
commit05e539175d9bac678fca8e77665e88b685729850 (patch)
tree3901c7460888e160f6520618892e9de02e6f69eb /lib/Checker/Environment.cpp
parenta0e27f00158c9306d53b0003b94182e415380ea9 (diff)
After inlining the CXXConstructExpr, bind the temporary object region to it.
This change is necessary when the variable is a const reference and we need the l-value of the construct expr. After that, when binding the variable, recover the lazy compound value when the variable is not a reference. In Environment, use the value of a no-op cast expression when it has one. Otherwise, blast-through it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122388 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Checker/Environment.cpp')
-rw-r--r--lib/Checker/Environment.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Checker/Environment.cpp b/lib/Checker/Environment.cpp
index 7bf2929161..954129883d 100644
--- a/lib/Checker/Environment.cpp
+++ b/lib/Checker/Environment.cpp
@@ -63,7 +63,12 @@ SVal Environment::getSVal(const Stmt *E, SValBuilder& svalBuilder) const {
if (CT->isVoidType())
return UnknownVal();
if (C->getCastKind() == CK_NoOp) {
- E = C->getSubExpr();
+ // If the no-op cast has value, use it. Should we always propagate
+ // values through all levels of no-op casts?
+ if (const SVal* X = ExprBindings.lookup(C))
+ return *X;
+ else
+ E = C->getSubExpr();
continue;
}
break;