From: Nuno Lopes Date: Sun, 18 Oct 2009 15:18:11 +0000 (+0000) Subject: add support for codegening CXXZeroInitValueExprs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=329763b1e9ec8c216025e3a8379ed446d7372cbc;p=clang add support for codegening CXXZeroInitValueExprs git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84418 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 01f719386c..88fdb542f3 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -112,6 +112,7 @@ public: void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E); void VisitCXXConstructExpr(const CXXConstructExpr *E); void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E); + void VisitCXXZeroInitValueExpr(CXXZeroInitValueExpr *E); void VisitVAArgExpr(VAArgExpr *E); @@ -439,6 +440,11 @@ void AggExprEmitter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) { CGF.EmitCXXExprWithTemporaries(E, DestPtr, VolatileDest, IsInitializer); } +void AggExprEmitter::VisitCXXZeroInitValueExpr(CXXZeroInitValueExpr *E) { + LValue lvalue = LValue::MakeAddr(DestPtr, Qualifiers()); + EmitNullInitializationToLValue(lvalue, E->getType()); +} + void AggExprEmitter::EmitInitializationToLValue(Expr* E, LValue LV) { // FIXME: Ignore result? // FIXME: Are initializers affected by volatile? diff --git a/test/CodeGenCXX/default-arg-temps.cpp b/test/CodeGenCXX/default-arg-temps.cpp index 2651446669..8385aff629 100644 --- a/test/CodeGenCXX/default-arg-temps.cpp +++ b/test/CodeGenCXX/default-arg-temps.cpp @@ -15,7 +15,7 @@ public: void g() { // RUN: grep "call void @_ZN1TC1Ev" %t | count 4 && - // RUN: grep "call void @_ZN1TD1Ev" %t | count 4 + // RUN: grep "call void @_ZN1TD1Ev" %t | count 4 && f(); f(); @@ -23,3 +23,10 @@ void g() { X b(a); X c = a; } + + +// RUN: grep memset %t +class obj{ int a; float b; double d; }; +void h() { + obj o = obj(); +}