]> granicus.if.org Git - clang/commitdiff
IRgen support for calls to functions that return references to aggregate exressions.
authorAnders Carlsson <andersca@mac.com>
Wed, 27 May 2009 16:45:02 +0000 (16:45 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 27 May 2009 16:45:02 +0000 (16:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72479 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprAgg.cpp
test/CodeGenCXX/references.cpp

index 00c1f8dbc1c2dcbdb873691b74ade041e76e84f4..59c00528a838bd5bac0105ef0f044564402f015d 100644 (file)
@@ -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);
 }
index 9d5a2ed9eef8a36c5c0189846b32677a8ec3d431..8e1935675766331d1cf151e3db8913283fd442f1 100644 (file)
@@ -74,6 +74,8 @@ void test_aggregate() {
 
   f(aggregate_return());
   aggregate_reference_return().a = 10;
+
+  c = aggregate_reference_return();
 }
 
 int& reference_return() {