summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFG.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-03-09 01:39:59 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-03-09 01:39:59 +0000
commit13f9664d2b9b31b38c6ee7c8190d86bbf93fef90 (patch)
tree9c3ce22cc8e0e0e90c0d29ff8a23ba3e98f2226c /clang/lib/Analysis/CFG.cpp
parent4b7ea1f33cc7efdd4b8223d079eec81671d18326 (diff)
downloadbcm5719-llvm-13f9664d2b9b31b38c6ee7c8190d86bbf93fef90.tar.gz
bcm5719-llvm-13f9664d2b9b31b38c6ee7c8190d86bbf93fef90.zip
[CFG] [analyzer] Add construction context for implicit constructor conversions.
Implicit constructor conversions such as A a = B() are represented by surrounding the constructor for B() with an ImplicitCastExpr of CK_ConstructorConversion kind, similarly to how explicit constructor conversions are surrounded by a CXXFunctionalCastExpr. Support this syntax pattern when extracting the construction context for the implicit constructor that performs the conversion. Differential Revision: https://reviews.llvm.org/D44051 llvm-svn: 327096
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r--clang/lib/Analysis/CFG.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index ae18278a0d9..9d11fcdbc78 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/lib/Analysis/CFG.cpp
@@ -1202,8 +1202,13 @@ void CFGBuilder::findConstructionContexts(
case Stmt::ImplicitCastExprClass: {
auto *Cast = cast<ImplicitCastExpr>(Child);
// TODO: We need to support CK_ConstructorConversion, maybe other kinds?
- if (Cast->getCastKind() == CK_NoOp)
+ switch (Cast->getCastKind()) {
+ case CK_NoOp:
+ case CK_ConstructorConversion:
findConstructionContexts(Layer, Cast->getSubExpr());
+ default:
+ break;
+ }
break;
}
case Stmt::CXXBindTemporaryExprClass: {
OpenPOWER on IntegriCloud