Start creating CXXBindReferenceExpr nodes when binding complex types to references.
llvm-svn: 94964
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 605f7797..c0dd68b 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -92,9 +92,31 @@
IsInitializer);
}
+llvm::Value *
+CodeGenFunction::EmitCXXBindReferenceExpr(const CXXBindReferenceExpr *E) {
+ QualType T = E->getType();
+ assert(T->isAnyComplexType() && "FIXME: Unhandled bind expression!");
+
+ const Expr *SubExpr = E->getSubExpr();
+
+ if (!E->requiresTemporaryCopy())
+ return EmitLValue(SubExpr).getAddress();
+
+ llvm::Value *Value = CreateTempAlloca(ConvertTypeForMem(T), "reftmp");
+
+ if (T->isAnyComplexType())
+ EmitComplexExprIntoAddr(SubExpr, Value, /*DestIsVolatile=*/false);
+ else
+ assert(false && "Unhandled bind expression");
+
+ return Value;
+}
+
RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
QualType DestType,
bool IsInitializer) {
+ assert(!E->getType()->isAnyComplexType() &&
+ "Should not use this function for complex types!");
bool ShouldDestroyTemporaries = false;
unsigned OldNumLiveTemporaries = 0;