summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFG.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-02-24 02:07:50 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-02-24 02:07:50 +0000
commit8cc55e9f16ddc19186dd593d2b69b6b43e04d6ac (patch)
tree15eee642d1cde8624b81659efcad6408a02d88b9 /clang/lib/Analysis/CFG.cpp
parentceb7d91a484982cfca84c102cfddb90b3963c46e (diff)
downloadbcm5719-llvm-8cc55e9f16ddc19186dd593d2b69b6b43e04d6ac.tar.gz
bcm5719-llvm-8cc55e9f16ddc19186dd593d2b69b6b43e04d6ac.zip
[CFG] Provide construction contexts for temporaries bound to const references.
In order to bind a temporary to a const lvalue reference, a no-op cast is added to make the temporary itself const, and only then the reference is taken (materialized). Skip the no-op cast when looking for the construction context. Differential Revision: https://reviews.llvm.org/D43481 llvm-svn: 326016
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r--clang/lib/Analysis/CFG.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 0d100397c0c..4c6eff300f8 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -1179,6 +1179,9 @@ void CFGBuilder::findConstructionContexts(
findConstructionContexts(ContextSoFar, Cleanups->getSubExpr());
} else if (auto *Cast = dyn_cast<CXXFunctionalCastExpr>(Child)) {
findConstructionContexts(ContextSoFar, Cast->getSubExpr());
+ } else if (auto *ImplicitCast = dyn_cast<ImplicitCastExpr>(Child)) {
+ if (ImplicitCast->getCastKind() == CK_NoOp)
+ findConstructionContexts(ContextSoFar, ImplicitCast->getSubExpr());
} else if (auto *BTE = dyn_cast<CXXBindTemporaryExpr>(Child)) {
findConstructionContexts(
ConstructionContext::create(cfg->getBumpVectorContext(), BTE,
OpenPOWER on IntegriCloud