Add EmitReferenceBindingToExpr. Have EmitCallArg use it for now. Doesn't support anything but at least we don't crash ;)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72147 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index e0ea2b9..0257494 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -260,4 +260,3 @@
   Name += '\0';
   return UniqueMangledName(Name.begin(), Name.end());
 }
-
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 10fc6d9..d444bae 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -2001,6 +2001,9 @@
 }
 
 RValue CodeGenFunction::EmitCallArg(const Expr *E, QualType ArgType) {
+  if (ArgType->isReferenceType())
+    return EmitReferenceBindingToExpr(E, ArgType);
+  
   return EmitAnyExprToTemp(E);
 }
 
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index ad0baa3..dc44798 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -70,6 +70,13 @@
   return EmitAnyExpr(E, AggLoc, isAggLocVolatile);
 }
 
+RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
+                                                   QualType DestType) {
+  CGM.ErrorUnsupported(E, "reference binding");
+  return GetUndefRValue(DestType);
+}
+
+
 /// getAccessedFieldNo - Given an encoded value and a result number, return
 /// the input field number being accessed.
 unsigned CodeGenFunction::getAccessedFieldNo(unsigned Idx, 
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index 081e44f..130bc36 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -708,6 +708,10 @@
   void EmitObjCSuperPropertySet(const Expr *E, const Selector &S, RValue Src);
 
 
+  /// EmitReferenceBindingToExpr - Emits a reference binding to the passed in
+  /// expression. Will emit a temporary variable if E is not an LValue.
+  RValue EmitReferenceBindingToExpr(const Expr* E, QualType DestType);
+  
   //===--------------------------------------------------------------------===//
   //                           Expression Emission
   //===--------------------------------------------------------------------===//