aboutsummaryrefslogtreecommitdiff
path: root/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'CodeGen')
-rw-r--r--CodeGen/CGExpr.cpp7
-rw-r--r--CodeGen/CodeGenFunction.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/CodeGen/CGExpr.cpp b/CodeGen/CGExpr.cpp
index 4cb897fe5d..84879bb28e 100644
--- a/CodeGen/CGExpr.cpp
+++ b/CodeGen/CGExpr.cpp
@@ -87,6 +87,7 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
return LValue::MakeAddr(llvm::UndefValue::get(Ty));
}
+ case Expr::CallExprClass: return EmitCallExprLValue(cast<CallExpr>(E));
case Expr::DeclRefExprClass: return EmitDeclRefLValue(cast<DeclRefExpr>(E));
case Expr::ParenExprClass:return EmitLValue(cast<ParenExpr>(E)->getSubExpr());
case Expr::PreDefinedExprClass:
@@ -455,6 +456,12 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) {
return EmitCallExpr(Callee, E);
}
+LValue CodeGenFunction::EmitCallExprLValue(const CallExpr *E) {
+ // Can only get l-value for call expression returning aggregate type
+ RValue RV = EmitCallExpr(E);
+ return LValue::MakeAddr(RV.getAggregateAddr());
+}
+
RValue CodeGenFunction::EmitCallExpr(llvm::Value *Callee, const CallExpr *E) {
// The callee type will always be a pointer to function type, get the function
// type.
diff --git a/CodeGen/CodeGenFunction.h b/CodeGen/CodeGenFunction.h
index 3b51d43de9..40c7414b98 100644
--- a/CodeGen/CodeGenFunction.h
+++ b/CodeGen/CodeGenFunction.h
@@ -371,6 +371,9 @@ public:
/// is 'Ty'.
void EmitStoreThroughLValue(RValue Src, LValue Dst, QualType Ty);
void EmitStoreThroughOCUComponentLValue(RValue Src, LValue Dst, QualType Ty);
+
+ // Note: only availabe for agg return types
+ LValue EmitCallExprLValue(const CallExpr *E);
LValue EmitDeclRefLValue(const DeclRefExpr *E);
LValue EmitStringLiteralLValue(const StringLiteral *E);