summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-20 01:35:03 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-20 01:35:03 +0000
commit7cd3a648b3d3057805c022b9470bbdfe21d732a5 (patch)
treec92ff1a7ee4f5bb731a4a75cb6a32fac509d0e12 /lib/CodeGen/CGExpr.cpp
parent9f75e6be16b9df33d58ec73955b3e3e3c71b2682 (diff)
downloadclang-7cd3a648b3d3057805c022b9470bbdfe21d732a5.tar.gz
clang-7cd3a648b3d3057805c022b9470bbdfe21d732a5.tar.bz2
clang-7cd3a648b3d3057805c022b9470bbdfe21d732a5.tar.xz
irgen for references to complex rvales (Very important...)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index eaf0873610..0886ad040a 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -79,11 +79,17 @@ RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
}
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");