[cfe-commits] r88971 - in /cfe/trunk: lib/CodeGen/CGCXX.cpp test/CodeGenCXX/copy-constructor-synthesis.cpp

Eli Friedman eli.friedman at gmail.com
Mon Nov 16 13:47:42 PST 2009


Author: efriedma
Date: Mon Nov 16 15:47:41 2009
New Revision: 88971

URL: http://llvm.org/viewvc/llvm-project?rev=88971&view=rev
Log:
Implement a few more cases for copy constructor synthesis.


Modified:
    cfe/trunk/lib/CodeGen/CGCXX.cpp
    cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Mon Nov 16 15:47:41 2009
@@ -1381,8 +1381,16 @@
     // Do a built-in assignment of scalar data members.
     LValue LHS = EmitLValueForField(LoadOfThis, *Field, false, 0);
     LValue RHS = EmitLValueForField(LoadOfSrc, *Field, false, 0);
-    RValue RVRHS = EmitLoadOfLValue(RHS, FieldType);
-    EmitStoreThroughLValue(RVRHS, LHS, FieldType);
+    if (!hasAggregateLLVMType(Field->getType())) {
+      RValue RVRHS = EmitLoadOfLValue(RHS, Field->getType());
+      EmitStoreThroughLValue(RVRHS, LHS, Field->getType());
+    } else if (Field->getType()->isAnyComplexType()) {
+      ComplexPairTy Pair = LoadComplexFromAddr(RHS.getAddress(),
+                                               RHS.isVolatileQualified());
+      StoreComplexToAddr(Pair, LHS.getAddress(), LHS.isVolatileQualified());
+    } else {
+      EmitAggregateCopy(LHS.getAddress(), RHS.getAddress(), Field->getType());
+    }
   }
   FinishFunction();
 }

Modified: cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp?rev=88971&r1=88970&r2=88971&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/copy-constructor-synthesis.cpp Mon Nov 16 15:47:41 2009
@@ -44,6 +44,8 @@
   const char *name;
   unsigned bf1 : 8;
   unsigned bf2 : 16;
+  int arr[2];
+  _Complex float complex;
 
   union {
     int au_i1;





More information about the cfe-commits mailing list