aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-27 16:45:02 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-27 16:45:02 +0000
commite70e8f7fef3efb3d526ee25b3a0e2a4bf67a04b6 (patch)
treebbf0cbcc6ad5cb51abb19a3f5680780ed9797408
parentbffed8a98cf5775cd39dc1765abc75c914513012 (diff)
IRgen support for calls to functions that return references to aggregate exressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72479 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGExprAgg.cpp5
-rw-r--r--test/CodeGenCXX/references.cpp2
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index 00c1f8dbc1..59c00528a8 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -186,6 +186,11 @@ void AggExprEmitter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
}
void AggExprEmitter::VisitCallExpr(const CallExpr *E) {
+ if (E->getCallReturnType()->isReferenceType()) {
+ EmitAggLoadOfLValue(E);
+ return;
+ }
+
RValue RV = CGF.EmitCallExpr(E);
EmitFinalDestCopy(E, RV);
}
diff --git a/test/CodeGenCXX/references.cpp b/test/CodeGenCXX/references.cpp
index 9d5a2ed9ee..8e19356757 100644
--- a/test/CodeGenCXX/references.cpp
+++ b/test/CodeGenCXX/references.cpp
@@ -74,6 +74,8 @@ void test_aggregate() {
f(aggregate_return());
aggregate_reference_return().a = 10;
+
+ c = aggregate_reference_return();
}
int& reference_return() {