aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprCXX.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-12-09 23:05:37 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-12-09 23:05:37 +0000
commit40563cd5ea402b7a0db13058ee869a77cd1ab5ee (patch)
tree868bb4cfb65c276bec93db755b6772d989823c8b /lib/CodeGen/CGExprCXX.cpp
parent9eed49c2bb0f37bbfefefd0998b6303a686a66c0 (diff)
Make array new on a pointer to data member type work correctly. PR11523.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprCXX.cpp')
-rw-r--r--lib/CodeGen/CGExprCXX.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp
index ed7605e34b..3f25806155 100644
--- a/lib/CodeGen/CGExprCXX.cpp
+++ b/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);