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
diff --git a/lib/Checker/Environment.cpp b/lib/Checker/Environment.cpp
index 7bf2929..9541298 100644
--- a/lib/Checker/Environment.cpp
+++ b/lib/Checker/Environment.cpp
@@ -63,7 +63,12 @@
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;