[cfe-commits] r102281 - in /cfe/trunk/lib/CodeGen: CGClass.cpp CodeGenFunction.h
Anders Carlsson
andersca at mac.com
Sat Apr 24 15:36:50 PDT 2010
Author: andersca
Date: Sat Apr 24 17:36:50 2010
New Revision: 102281
URL: http://llvm.org/viewvc/llvm-project?rev=102281&view=rev
Log:
Simplify EmitClassMemberwiseCopy now that it's only used for fields.
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=102281&r1=102280&r2=102281&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Sat Apr 24 17:36:50 2010
@@ -590,33 +590,21 @@
/// EmitClassMemberwiseCopy - This routine generates code to copy a class
-/// object from SrcValue to DestValue. Copying can be either a bitwise copy
-/// or via a copy constructor call.
-void CodeGenFunction::EmitClassMemberwiseCopy(
- llvm::Value *Dest, llvm::Value *Src,
- const CXXRecordDecl *ClassDecl,
- const CXXRecordDecl *BaseClassDecl, QualType Ty) {
- 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, Ty);
+/// object from SrcValue to DestValue.
+void CodeGenFunction::EmitClassMemberwiseCopy(llvm::Value *Dest,
+ llvm::Value *Src,
+ const CXXRecordDecl *ClassDecl) {
+ if (ClassDecl->hasTrivialCopyConstructor()) {
+ EmitAggregateCopy(Dest, Src, getContext().getTagDeclType(ClassDecl));
return;
}
- CXXConstructorDecl *BaseCopyCtor =
- BaseClassDecl->getCopyConstructor(getContext(), 0);
- if (!BaseCopyCtor)
- return;
-
- llvm::Value *VTT = GetVTTParameter(*this, GlobalDecl(BaseCopyCtor, CtorType));
- EmitCopyCtorCall(*this, BaseCopyCtor, CtorType, Dest, VTT, Src);
+ // FIXME: Does this get the right copy constructor?
+ const CXXConstructorDecl *CopyConstructor =
+ ClassDecl->getCopyConstructor(getContext(), 0);
+ assert(CopyConstructor && "Did not find copy constructor!");
+
+ EmitCopyCtorCall(*this, CopyConstructor, Ctor_Complete, Dest, 0, Src);
}
/// EmitClassCopyAssignment - This routine generates code to copy assign a class
@@ -719,7 +707,7 @@
}
else
EmitClassMemberwiseCopy(LHS.getAddress(), RHS.getAddress(),
- 0 /*ClassDecl*/, FieldClassDecl, FieldType);
+ FieldClassDecl);
continue;
}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=102281&r1=102280&r2=102281&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Sat Apr 24 17:36:50 2010
@@ -814,9 +814,7 @@
QualType Ty);
void EmitClassMemberwiseCopy(llvm::Value *DestValue, llvm::Value *SrcValue,
- const CXXRecordDecl *ClassDecl,
- const CXXRecordDecl *BaseClassDecl,
- QualType Ty);
+ const CXXRecordDecl *ClassDecl);
void EmitClassCopyAssignment(llvm::Value *DestValue, llvm::Value *SrcValue,
const CXXRecordDecl *ClassDecl,
More information about the cfe-commits
mailing list