summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-08-25 07:11:29 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-08-25 07:11:29 +0000
commit48ddcf2cb57caf57f8e1f1029f39fc490de74e08 (patch)
treec4150dcdc3ae326df0e6b80187f44fcbc6202081 /clang/lib
parenta374bf0ae1e8e941cbb33a0a92c3ab660697e875 (diff)
downloadbcm5719-llvm-48ddcf2cb57caf57f8e1f1029f39fc490de74e08.tar.gz
bcm5719-llvm-48ddcf2cb57caf57f8e1f1029f39fc490de74e08.zip
Fix a CodeGen bug where we would skip zero-initialization for
array new with a non-trivial constructor. Pointed out in PR13380. llvm-svn: 162643
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 0faf98032c1..17e2bc18744 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -956,7 +956,6 @@ static void EmitNewInitializer(CodeGenFunction &CGF, const CXXNewExpr *E,
if (E->isArray()) {
if (const CXXConstructExpr *CCE = dyn_cast_or_null<CXXConstructExpr>(Init)){
CXXConstructorDecl *Ctor = CCE->getConstructor();
- bool RequiresZeroInitialization = false;
if (Ctor->isTrivial()) {
// If new expression did not specify value-initialization, then there
// is no initialization.
@@ -969,13 +968,11 @@ static void EmitNewInitializer(CodeGenFunction &CGF, const CXXNewExpr *E,
EmitZeroMemSet(CGF, ElementType, NewPtr, AllocSizeWithoutCookie);
return;
}
-
- RequiresZeroInitialization = true;
}
CGF.EmitCXXAggrConstructorCall(Ctor, NumElements, NewPtr,
CCE->arg_begin(), CCE->arg_end(),
- RequiresZeroInitialization);
+ CCE->requiresZeroInitialization());
return;
} else if (Init && isa<ImplicitValueInitExpr>(Init) &&
CGF.CGM.getTypes().isZeroInitializable(ElementType)) {
OpenPOWER on IntegriCloud