[cfe-commits] r99134 - in /cfe/trunk: lib/CodeGen/CGExprAgg.cpp test/CodeGenCXX/temporaries.cpp
Rafael Espindola
rafael.espindola at gmail.com
Sun Mar 21 10:11:05 PDT 2010
Author: rafael
Date: Sun Mar 21 12:11:05 2010
New Revision: 99134
URL: http://llvm.org/viewvc/llvm-project?rev=99134&view=rev
Log:
Fix PR6648 by not creating a temporary with the type of a
CXXExprWithTemporaries.
Not emitting the expression as an aggregate might be the right thing to do,
but is orthogonal. Emitting it as an scalar expression will still try to
create a temporary for the incomplete type of the CXXExprWithTemporaries and
fail.
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/test/CodeGenCXX/temporaries.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=99134&r1=99133&r2=99134&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Sun Mar 21 12:11:05 2010
@@ -500,10 +500,6 @@
void AggExprEmitter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
llvm::Value *Val = DestPtr;
- if (!Val) {
- // Create a temporary variable.
- Val = CGF.CreateMemTemp(E->getType(), "tmp");
- }
CGF.EmitCXXExprWithTemporaries(E, Val, VolatileDest, IsInitializer);
}
Modified: cfe/trunk/test/CodeGenCXX/temporaries.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/temporaries.cpp?rev=99134&r1=99133&r2=99134&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/temporaries.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/temporaries.cpp Sun Mar 21 12:11:05 2010
@@ -288,3 +288,16 @@
}
}
+
+namespace PR6648 {
+ struct B {
+ ~B();
+ };
+ B foo;
+ struct D;
+ D& zed(B);
+ void foobar() {
+ // CHECK: call %"struct.PR6648::D"* @_ZN6PR66483zedENS_1BE
+ zed(foo);
+ }
+}
More information about the cfe-commits
mailing list