diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-05-20 01:03:17 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-05-20 01:03:17 +0000 |
| commit | 145eae52248031baddc00b680ce957cbb5961e2d (patch) | |
| tree | 7595a655f7f14ed7200b6457d077811135f22999 /clang/lib/CodeGen | |
| parent | 9cbf8505062a290ce0352867aa0a0795c5a02da6 (diff) | |
| download | bcm5719-llvm-145eae52248031baddc00b680ce957cbb5961e2d.tar.gz bcm5719-llvm-145eae52248031baddc00b680ce957cbb5961e2d.zip | |
Add support for binding references to scalar rvalues.
llvm-svn: 72153
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index bb9f20003ac..299bb6b4a4a 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -78,6 +78,14 @@ RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E, return RValue::get(LV.getAddress()); } + if (!hasAggregateLLVMType(E->getType())) { + // Make 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); + } + CGM.ErrorUnsupported(E, "reference binding"); return GetUndefRValue(DestType); } |

