Enable CodeGen for member expressions based on call expressions returning aggregate types. This enables expressions like 'foo().member.submember'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45395 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGExpr.cpp b/CodeGen/CGExpr.cpp
index 4cb897f..84879bb 100644
--- a/CodeGen/CGExpr.cpp
+++ b/CodeGen/CGExpr.cpp
@@ -87,6 +87,7 @@
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 @@
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.