summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGExprCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index ed7605e34b8..3f25806155f 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -828,7 +828,7 @@ CodeGenFunction::EmitNewArrayInitializer(const CXXNewExpr *E,
StoreAnyExprIntoOneUnit(*this, E, curPtr);
// Leave the cleanup if we entered one.
- if (cleanup != EHStack.stable_end()) {
+ if (cleanupDominator) {
DeactivateCleanupBlock(cleanup, cleanupDominator);
cleanupDominator->eraseFromParent();
}
@@ -883,7 +883,8 @@ static void EmitNewInitializer(CodeGenFunction &CGF, const CXXNewExpr *E,
RequiresZeroInitialization);
return;
} else if (E->getNumConstructorArgs() == 1 &&
- isa<ImplicitValueInitExpr>(E->getConstructorArg(0))) {
+ isa<ImplicitValueInitExpr>(E->getConstructorArg(0)) &&
+ CGF.CGM.getTypes().isZeroInitializable(ElementType)) {
// Optimization: since zero initialization will just set the memory
// to all zeroes, generate a single memset to do it in one shot.
EmitZeroMemSet(CGF, ElementType, NewPtr, AllocSizeWithoutCookie);
OpenPOWER on IntegriCloud