Generalize RValue to handle complex better, generalize EmitCompoundStmt to
support any sort of expr, add a new EmitAnyExpr routine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41660 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGStmt.cpp b/CodeGen/CGStmt.cpp
index 85a6ca8..3a4fd95 100644
--- a/CodeGen/CGStmt.cpp
+++ b/CodeGen/CGStmt.cpp
@@ -63,7 +63,8 @@
/// EmitCompoundStmt - Emit a compound statement {..} node. If GetLast is true,
/// this captures the expression result of the last sub-statement and returns it
/// (for use by the statement expression extension).
-RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast) {
+RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
+ llvm::Value *AggLoc, bool isAggVol) {
// FIXME: handle vla's etc.
if (S.body_empty() || !isa<Expr>(S.body_back())) GetLast = false;
@@ -74,15 +75,8 @@
if (!GetLast)
return RValue::get(0);
-
- const Expr *Last = cast<Expr>(S.body_back());
- if (!hasAggregateLLVMType(Last->getType()))
- return RValue::get(EmitScalarExpr(Last));
- assert(0 && "Unimp");
- //else if (Last->getType()->isComplexType())
- // EmitComplexExpr(Last);
- //else
- // EmitAggExpr(E, 0, false);
+
+ return EmitAnyExpr(cast<Expr>(S.body_back()), AggLoc);
}
void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB) {