summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorJF Bastien <jfbastien@apple.com>2019-07-25 20:50:09 +0000
committerJF Bastien <jfbastien@apple.com>2019-07-25 20:50:09 +0000
commitfd1274fa78cb0fd32cc1fa2e6f5bb8e62d29df19 (patch)
tree4903a8ecbf4bd930b8d42fe96c60c68e89690004 /lib/CodeGen/CGExprAgg.cpp
parentc0048be7ff340ebba3092e95d82147bc9928b909 (diff)
downloadclang-fd1274fa78cb0fd32cc1fa2e6f5bb8e62d29df19.tar.gz
Revert "CodeGen: ensure placeholder instruction for cleanup is created"
Originally in https://reviews.llvm.org/D64656 Causes bot failures: /home/buildslave/buildslave/clang-cmake-armv8-full/llvm/tools/clang/test/CodeGenCXX/pr40771-ctad-with-lambda-copy-capture.cpp:20:16: error: CHECK-NEXT: expected string not found in input // CHECK-NEXT: call void @_ZN1RC1E1Q(%struct.R* [[TMP_R]]) ^ <stdin>:37:2: note: scanning from here %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1) ^ <stdin>:37:2: note: with "TMP_R" equal to "%1" %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1) ^ <stdin>:37:17: note: possible intended match here %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1) ^ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367051 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--lib/CodeGen/CGExprAgg.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index 0a57870a7c..695facd50b 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -1495,13 +1495,6 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) {
// initializers throws an exception.
SmallVector<EHScopeStack::stable_iterator, 16> cleanups;
llvm::Instruction *cleanupDominator = nullptr;
- auto addCleanup = [&](const EHScopeStack::stable_iterator &cleanup) {
- cleanups.push_back(cleanup);
- if (!cleanupDominator) // create placeholder once needed
- cleanupDominator = CGF.Builder.CreateAlignedLoad(
- CGF.Int8Ty, llvm::Constant::getNullValue(CGF.Int8PtrTy),
- CharUnits::One());
- };
unsigned curInitIndex = 0;
@@ -1526,7 +1519,7 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) {
if (QualType::DestructionKind dtorKind =
Base.getType().isDestructedType()) {
CGF.pushDestroy(dtorKind, V, Base.getType());
- addCleanup(CGF.EHStack.stable_begin());
+ cleanups.push_back(CGF.EHStack.stable_begin());
}
}
}
@@ -1603,9 +1596,15 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) {
= field->getType().isDestructedType()) {
assert(LV.isSimple());
if (CGF.needsEHCleanup(dtorKind)) {
+ if (!cleanupDominator)
+ cleanupDominator = CGF.Builder.CreateAlignedLoad(
+ CGF.Int8Ty,
+ llvm::Constant::getNullValue(CGF.Int8PtrTy),
+ CharUnits::One()); // placeholder
+
CGF.pushDestroy(EHCleanup, LV.getAddress(), field->getType(),
CGF.getDestroyer(dtorKind), false);
- addCleanup(CGF.EHStack.stable_begin());
+ cleanups.push_back(CGF.EHStack.stable_begin());
pushedCleanup = true;
}
}
@@ -1621,8 +1620,6 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) {
// Deactivate all the partial cleanups in reverse order, which
// generally means popping them.
- assert((cleanupDominator || cleanups.empty()) &&
- "Missing cleanupDominator before deactivating cleanup blocks");
for (unsigned i = cleanups.size(); i != 0; --i)
CGF.DeactivateCleanupBlock(cleanups[i-1], cleanupDominator);