[cfe-commits] r72479 - in /cfe/trunk: lib/CodeGen/CGExprAgg.cpp test/CodeGenCXX/references.cpp

Anders Carlsson andersca at mac.com
Wed May 27 09:45:14 PDT 2009


Author: andersca
Date: Wed May 27 11:45:02 2009
New Revision: 72479

URL: http://llvm.org/viewvc/llvm-project?rev=72479&view=rev
Log:
IRgen support for calls to functions that return references to aggregate exressions.

Modified:
    cfe/trunk/lib/CodeGen/CGExprAgg.cpp
    cfe/trunk/test/CodeGenCXX/references.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=72479&r1=72478&r2=72479&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed May 27 11:45:02 2009
@@ -186,6 +186,11 @@
 }
 
 void AggExprEmitter::VisitCallExpr(const CallExpr *E) {
+  if (E->getCallReturnType()->isReferenceType()) {
+    EmitAggLoadOfLValue(E);
+    return;
+  }
+  
   RValue RV = CGF.EmitCallExpr(E);
   EmitFinalDestCopy(E, RV);
 }

Modified: cfe/trunk/test/CodeGenCXX/references.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/references.cpp?rev=72479&r1=72478&r2=72479&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/references.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/references.cpp Wed May 27 11:45:02 2009
@@ -74,6 +74,8 @@
 
   f(aggregate_return());
   aggregate_reference_return().a = 10;
+
+  c = aggregate_reference_return();
 }
 
 int& reference_return() {





More information about the cfe-commits mailing list