]> granicus.if.org Git - clang/commitdiff
Add EmitReferenceBindingToExpr. Have EmitCallArg use it for now. Doesn't support...
authorAnders Carlsson <andersca@mac.com>
Wed, 20 May 2009 00:24:07 +0000 (00:24 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 20 May 2009 00:24:07 +0000 (00:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72147 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCXX.cpp
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.h

index e0ea2b98eb07e3c42c09fa4cc1022a154ccb6208..025749497741e81b7314609cddb44d8174603da2 100644 (file)
@@ -260,4 +260,3 @@ const char *CodeGenModule::getMangledCXXDtorName(const CXXDestructorDecl *D,
   Name += '\0';
   return UniqueMangledName(Name.begin(), Name.end());
 }
-
index 10fc6d95c25b305bd1098d0e39f46b153a0ec74b..d444baec8e3e64834e2f52a6f47c806f933fe5c3 100644 (file)
@@ -2001,6 +2001,9 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI,
 }
 
 RValue CodeGenFunction::EmitCallArg(const Expr *E, QualType ArgType) {
+  if (ArgType->isReferenceType())
+    return EmitReferenceBindingToExpr(E, ArgType);
+  
   return EmitAnyExprToTemp(E);
 }
 
index ad0baa32f9493e3bced5848144408b40526094d3..dc447983f0e4a3d74b2aebf6e5221ef94aee1ae6 100644 (file)
@@ -70,6 +70,13 @@ RValue CodeGenFunction::EmitAnyExprToTemp(const Expr *E, llvm::Value *AggLoc,
   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, 
index 081e44f915f88910373103d9b67a0c63df8b41de..130bc369e3bc87aaf023e148b93e42ae51dbbef0 100644 (file)
@@ -708,6 +708,10 @@ public:
   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
   //===--------------------------------------------------------------------===//