[cfe-commits] r111780 - in /cfe/trunk: lib/Sema/TreeTransform.h test/CodeGenCXX/value-init.cpp
Douglas Gregor
dgregor at apple.com
Sun Aug 22 10:20:18 PDT 2010
Author: dgregor
Date: Sun Aug 22 12:20:18 2010
New Revision: 111780
URL: http://llvm.org/viewvc/llvm-project?rev=111780&view=rev
Log:
Preserve the zero-initialization and construction-kind settings when
instantiating CXXConstructExpr expressions.
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/CodeGenCXX/value-init.cpp
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=111780&r1=111779&r2=111780&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Sun Aug 22 12:20:18 2010
@@ -1684,14 +1684,17 @@
SourceLocation Loc,
CXXConstructorDecl *Constructor,
bool IsElidable,
- MultiExprArg Args) {
+ MultiExprArg Args,
+ bool RequiresZeroInit,
+ CXXConstructExpr::ConstructionKind ConstructKind) {
ASTOwningVector<&ActionBase::DeleteExpr> ConvertedArgs(SemaRef);
if (getSema().CompleteConstructorCall(Constructor, move(Args), Loc,
ConvertedArgs))
return getSema().ExprError();
return getSema().BuildCXXConstructExpr(Loc, T, Constructor, IsElidable,
- move_arg(ConvertedArgs));
+ move_arg(ConvertedArgs),
+ RequiresZeroInit, ConstructKind);
}
/// \brief Build a new object-construction expression.
@@ -5686,7 +5689,9 @@
return getDerived().RebuildCXXConstructExpr(T, /*FIXME:*/E->getLocStart(),
Constructor, E->isElidable(),
- move_arg(Args));
+ move_arg(Args),
+ E->requiresZeroInitialization(),
+ E->getConstructionKind());
}
/// \brief Transform a C++ temporary-binding expression.
Modified: cfe/trunk/test/CodeGenCXX/value-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/value-init.cpp?rev=111780&r1=111779&r2=111780&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/value-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/value-init.cpp Sun Aug 22 12:20:18 2010
@@ -111,4 +111,30 @@
// CHECK-NEXT: call void @_ZN8zeroinit2X11fEv
X1().f();
}
+
+ template<typename>
+ struct X2 : X0 {
+ int x2;
+ void f();
+ };
+
+ template<typename>
+ struct X3 : X2<int> {
+ X3() : X2<int>() { }
+ };
+
+
+ // CHECK: define void @_ZN8zeroinit9testX0_X3Ev
+ void testX0_X3() {
+ // CHECK-NOT: call void @llvm.memset
+ // CHECK: call void @_ZN8zeroinit2X3IiEC1Ev
+ // CHECK: call void @_ZN8zeroinit2X2IiE1fEv
+ // CHECK-NEXT: ret void
+ X3<int>().f();
+ }
+
+ // CHECK: define linkonce_odr void @_ZN8zeroinit2X3IiEC2Ev
+ // CHECK: call void @llvm.memset.p0i8.i64
+ // CHECK-NEXT: call void @_ZN8zeroinit2X2IiEC2Ev
+ // CHECK-NEXT: ret void
}
More information about the cfe-commits
mailing list