[cfe-commits] r94800 - /cfe/trunk/lib/CodeGen/CGClass.cpp

Anders Carlsson andersca at mac.com
Thu Jan 28 21:41:25 PST 2010


Author: andersca
Date: Thu Jan 28 23:41:25 2010
New Revision: 94800

URL: http://llvm.org/viewvc/llvm-project?rev=94800&view=rev
Log:
Use EmitLValueForFieldInitialization when synthesizing the copy ctor as well.

Modified:
    cfe/trunk/lib/CodeGen/CGClass.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Thu Jan 28 23:41:25 2010
@@ -647,26 +647,9 @@
       continue;
     }
     
-    if (Field->getType()->isReferenceType()) {
-      unsigned FieldIndex = CGM.getTypes().getLLVMFieldNo(Field);
- 
-      llvm::Value *LHS = Builder.CreateStructGEP(LoadOfThis, FieldIndex,
-                                                 "lhs.ref");
-      
-      llvm::Value *RHS = Builder.CreateStructGEP(LoadOfThis, FieldIndex,
-                                                 "rhs.ref");
-
-      // Load the value in RHS.
-      RHS = Builder.CreateLoad(RHS);
-      
-      // And store it in the LHS
-      Builder.CreateStore(RHS, LHS);
-
-      continue;
-    }
     // Do a built-in assignment of scalar data members.
-    LValue LHS = EmitLValueForField(LoadOfThis, Field, 0);
-    LValue RHS = EmitLValueForField(LoadOfSrc, Field, 0);
+    LValue LHS = EmitLValueForFieldInitialization(LoadOfThis, Field, 0);
+    LValue RHS = EmitLValueForFieldInitialization(LoadOfSrc, Field, 0);
 
     if (!hasAggregateLLVMType(Field->getType())) {
       RValue RVRHS = EmitLoadOfLValue(RHS, Field->getType());





More information about the cfe-commits mailing list