summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen
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
commit0370eb20342a1b4118ca66366f25de8dc1c929bd (patch)
treee9a1caa2bda35e7e43070b1bd4c9f987c561a0ea /clang/CodeGen
parentd822d68b745e118d2f4181e775f0d6ad648137fc (diff)
downloadbcm5719-llvm-0370eb20342a1b4118ca66366f25de8dc1c929bd.tar.gz
bcm5719-llvm-0370eb20342a1b4118ca66366f25de8dc1c929bd.zip
Handle function calls that return aggregate expressions.
llvm-svn: 43581
Diffstat (limited to 'clang/CodeGen')
-rw-r--r--clang/CodeGen/CGExprAgg.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/CodeGen/CGExprAgg.cpp b/clang/CodeGen/CGExprAgg.cpp
index 160f491c5e8..ea36225ba58 100644
--- a/clang/CodeGen/CGExprAgg.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud