aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2007-10-31 22:04:46 +0000
committerAnders Carlsson <andersca@mac.com>2007-10-31 22:04:46 +0000
commit148fe6772733166c720e28b7bb5084af6e624b44 (patch)
tree8866e5e144f0ea0120201e3634083f16a94f34ef /CodeGen/CGExprAgg.cpp
parent19d74e1494fe399f0e2a94e9419c095f8214851b (diff)
Handle function calls that return aggregate expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CGExprAgg.cpp')
-rw-r--r--CodeGen/CGExprAgg.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/CodeGen/CGExprAgg.cpp b/CodeGen/CGExprAgg.cpp
index 160f491c5e..ea36225ba5 100644
--- a/CodeGen/CGExprAgg.cpp
+++ b/CodeGen/CGExprAgg.cpp
@@ -67,7 +67,7 @@ public:
// case Expr::UnaryOperatorClass:
// case Expr::ImplicitCastExprClass:
// case Expr::CastExprClass:
- // case Expr::CallExprClass:
+ void VisitCallExpr(const CallExpr *E);
void VisitStmtExpr(const StmtExpr *E);
void VisitBinaryOperator(const BinaryOperator *BO);
void VisitBinAssign(const BinaryOperator *E);
@@ -132,6 +132,19 @@ void AggExprEmitter::EmitAggLoadOfLValue(const Expr *E) {
// Visitor Methods
//===----------------------------------------------------------------------===//
+void AggExprEmitter::VisitCallExpr(const CallExpr *E)
+{
+ RValue RV = CGF.EmitCallExpr(E);
+ assert(RV.isAggregate() && "Return value must be aggregate value!");
+
+ // If the result is ignored, don't copy from the value.
+ if (DestPtr == 0)
+ // FIXME: If the source is volatile, we must read from it.
+ return;
+
+ EmitAggregateCopy(DestPtr, RV.getAggregateAddr(), E->getType());
+}
+
void AggExprEmitter::VisitStmtExpr(const StmtExpr *E) {
CGF.EmitCompoundStmt(*E->getSubStmt(), true, DestPtr, VolatileDest);
}