summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/ConstructionContext.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/ConstructionContext.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/ConstructionContext.cpp')
-rw-r--r--clang/lib/Analysis/ConstructionContext.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Analysis/ConstructionContext.cpp b/clang/lib/Analysis/ConstructionContext.cpp
index aea329b1fea..1a1bc7db8fb 100644
--- a/clang/lib/Analysis/ConstructionContext.cpp
+++ b/clang/lib/Analysis/ConstructionContext.cpp
@@ -70,8 +70,11 @@ const ConstructionContext *ConstructionContext::createFromLayers(
C.getAllocator().Allocate<TemporaryObjectConstructionContext>();
return new (CC) TemporaryObjectConstructionContext(BTE, MTE);
} else if (const auto *MTE = dyn_cast<MaterializeTemporaryExpr>(S)) {
+ // If the object requires destruction and is not lifetime-extended,
+ // then it must have a BTE within its MTE.
assert(MTE->getType().getCanonicalType()
- ->getAsCXXRecordDecl()->hasTrivialDestructor());
+ ->getAsCXXRecordDecl()->hasTrivialDestructor() ||
+ MTE->getStorageDuration() != SD_FullExpression);
assert(TopLayer->isLast());
auto *CC =
C.getAllocator().Allocate<TemporaryObjectConstructionContext>();
OpenPOWER on IntegriCloud