[cfe-commits] r102846 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CodeGenFunction.h

Anders Carlsson andersca at mac.com
Sat May 1 09:54:05 PDT 2010


Author: andersca
Date: Sat May  1 11:54:05 2010
New Revision: 102846

URL: http://llvm.org/viewvc/llvm-project?rev=102846&view=rev
Log:
Clean up EmitClassMemberwiseCopy further.

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

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=102846&r1=102845&r2=102846&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Sat May  1 11:54:05 2010
@@ -593,29 +593,18 @@
 /// or via a copy constructor call.
 void CodeGenFunction::EmitClassMemberwiseCopy(
                         llvm::Value *Dest, llvm::Value *Src,
-                        const CXXRecordDecl *ClassDecl,
-                        const CXXRecordDecl *BaseClassDecl) {
-  CXXCtorType CtorType = Ctor_Complete;
-  
-  if (ClassDecl) {
-    Dest = OldGetAddressOfBaseClass(Dest, ClassDecl, BaseClassDecl);
-    Src = OldGetAddressOfBaseClass(Src, ClassDecl, BaseClassDecl);
-
-    // We want to call the base constructor.
-    CtorType = Ctor_Base;
-  }
-  if (BaseClassDecl->hasTrivialCopyConstructor()) {
-    EmitAggregateCopy(Dest, Src, getContext().getTagDeclType(BaseClassDecl));
+                        const CXXRecordDecl *ClassDecl) {
+  if (ClassDecl->hasTrivialCopyConstructor()) {
+    EmitAggregateCopy(Dest, Src, getContext().getTagDeclType(ClassDecl));
     return;
   }
 
-  CXXConstructorDecl *BaseCopyCtor =
-    BaseClassDecl->getCopyConstructor(getContext(), 0);
-  if (!BaseCopyCtor)
-    return;
+  CXXConstructorDecl *CopyCtor = ClassDecl->getCopyConstructor(getContext(), 0);
+  assert(CopyCtor && "Did not have copy ctor!");
 
-  llvm::Value *VTT = GetVTTParameter(*this, GlobalDecl(BaseCopyCtor, CtorType));
-  EmitCopyCtorCall(*this, BaseCopyCtor, CtorType, Dest, VTT, Src);
+  llvm::Value *VTT = GetVTTParameter(*this, GlobalDecl(CopyCtor, 
+                                                       Ctor_Complete));
+  EmitCopyCtorCall(*this, CopyCtor, Ctor_Complete, Dest, VTT, Src);
 }
 
 /// EmitClassCopyAssignment - This routine generates code to copy assign a class
@@ -718,7 +707,7 @@
       }
       else
         EmitClassMemberwiseCopy(LHS.getAddress(), RHS.getAddress(),
-                                0 /*ClassDecl*/, FieldClassDecl);
+                                FieldClassDecl);
       continue;
     }
     

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=102846&r1=102845&r2=102846&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sat May  1 11:54:05 2010
@@ -818,8 +818,7 @@
                                    QualType Ty);
 
   void EmitClassMemberwiseCopy(llvm::Value *DestValue, llvm::Value *SrcValue,
-                               const CXXRecordDecl *ClassDecl,
-                               const CXXRecordDecl *BaseClassDecl);
+                               const CXXRecordDecl *ClassDecl);
 
   void EmitClassCopyAssignment(llvm::Value *DestValue, llvm::Value *SrcValue,
                                const CXXRecordDecl *ClassDecl);





More information about the cfe-commits mailing list