summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
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
commit6f5a015bd9528383ea5ca591a6c6c070c800d7d6 (patch)
tree0e57e944932eaff73068ccff89f81112c7ef5e9a /clang/lib/CodeGen
parent95fc37fd8fe5537dbea9dfef55e61696a55a36d7 (diff)
downloadbcm5719-llvm-6f5a015bd9528383ea5ca591a6c6c070c800d7d6.tar.gz
bcm5719-llvm-6f5a015bd9528383ea5ca591a6c6c070c800d7d6.zip
Add EmitReferenceBindingToExpr. Have EmitCallArg use it for now. Doesn't support anything but at least we don't crash ;)
llvm-svn: 72147
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGCXX.cpp1
-rw-r--r--clang/lib/CodeGen/CGCall.cpp3
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp7
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h4
4 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp
index e0ea2b98eb0..02574949774 100644
--- a/clang/lib/CodeGen/CGCXX.cpp
+++ b/clang/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/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 10fc6d95c25..d444baec8e3 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/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/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index ad0baa32f94..dc447983f0e 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/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/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 081e44f915f..130bc369e3b 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/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
//===--------------------------------------------------------------------===//
OpenPOWER on IntegriCloud