[cfe-commits] r72157 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGenCXX/references.cpp
Anders Carlsson
andersca at mac.com
Tue May 19 18:35:03 PDT 2009
Author: andersca
Date: Tue May 19 20:35:03 2009
New Revision: 72157
URL: http://llvm.org/viewvc/llvm-project?rev=72157&view=rev
Log:
irgen for references to complex rvales (Very important...)
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/test/CodeGenCXX/references.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=72157&r1=72156&r2=72157&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue May 19 20:35:03 2009
@@ -79,11 +79,17 @@
}
if (!hasAggregateLLVMType(E->getType())) {
- // Make a temporary variable that we can bind the reference to.
+ // Create a temporary variable that we can bind the reference to.
llvm::Value *Temp = CreateTempAlloca(ConvertTypeForMem(E->getType()),
"reftmp");
EmitStoreOfScalar(EmitScalarExpr(E), Temp, false, E->getType());
return RValue::get(Temp);
+ } else if (E->getType()->isAnyComplexType()) {
+ // Create a temporary variable that we can bind the reference to.
+ llvm::Value *Temp = CreateTempAlloca(ConvertTypeForMem(E->getType()),
+ "reftmp");
+ EmitComplexExprIntoAddr(E, Temp, false);
+ return RValue::get(Temp);
}
CGM.ErrorUnsupported(E, "reference binding");
Modified: cfe/trunk/test/CodeGenCXX/references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/references.cpp?rev=72157&r1=72156&r2=72157&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/references.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/references.cpp Tue May 19 20:35:03 2009
@@ -44,6 +44,8 @@
void test_complex() {
_Complex int a = 10i;
f(a);
+
+ f(10i);
}
void test_aggregate() {
More information about the cfe-commits
mailing list