aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-20 00:24:07 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-20 00:24:07 +0000
commit4029ca7ae9d3ffd7738fe2ed8782bebc30f36fd6 (patch)
tree2eadf6254d694ec3ff514796cb5eb9d4920f959e
parent32110dfd1c612e97996fa87c3ca6180461b9fb1f (diff)
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
-rw-r--r--lib/CodeGen/CGCXX.cpp1
-rw-r--r--lib/CodeGen/CGCall.cpp3
-rw-r--r--lib/CodeGen/CGExpr.cpp7
-rw-r--r--lib/CodeGen/CodeGenFunction.h4
4 files changed, 14 insertions, 1 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index e0ea2b98eb..0257494977 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -260,4 +260,3 @@ const char *CodeGenModule::getMangledCXXDtorName(const CXXDestructorDecl *D,
Name += '\0';
return UniqueMangledName(Name.begin(), Name.end());
}
-
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 10fc6d95c2..d444baec8e 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -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);
}
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index ad0baa32f9..dc447983f0 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -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,
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index 081e44f915..130bc369e3 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -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
//===--------------------------------------------------------------------===//