forked from OSchip/llvm-project
Rename AddressCXXOfBaseClass to GetAddressCXXOfBaseClass. Add a NullCheckValue argument (currently unused).
llvm-svn: 81606
This commit is contained in:
parent
dad2da59ad
commit
864d525533
|
@ -362,7 +362,7 @@
|
|||
1A32C17E0E1C87AD00A6B483 /* ExprConstant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = ExprConstant.cpp; path = lib/AST/ExprConstant.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1A376A2C0D4AED9B002A1C52 /* CGExprConstant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGExprConstant.cpp; path = lib/CodeGen/CGExprConstant.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1A471AB40F437BC500753CE8 /* CGBlocks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGBlocks.cpp; path = lib/CodeGen/CGBlocks.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1A4C41BE105B4C0B0047B5E7 /* CGCXXClass.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CGCXXClass.cpp; path = lib/CodeGen/CGCXXClass.cpp; sourceTree = "<group>"; };
|
||||
1A4C41BE105B4C0B0047B5E7 /* CGCXXClass.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGCXXClass.cpp; path = lib/CodeGen/CGCXXClass.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1A5119C30FBDF71000A1FF22 /* SemaTemplateInstantiateStmt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = SemaTemplateInstantiateStmt.cpp; path = lib/Sema/SemaTemplateInstantiateStmt.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1A5D5E570E5E81010023C059 /* CGCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGCXX.cpp; path = lib/CodeGen/CGCXX.cpp; sourceTree = "<group>"; tabWidth = 2; };
|
||||
1A649E1D0F9599D9005B965E /* CGBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CGBlocks.h; path = lib/CodeGen/CGBlocks.h; sourceTree = "<group>"; };
|
||||
|
|
|
@ -1498,8 +1498,10 @@ void CodeGenFunction::EmitClassMemberwiseCopy(
|
|||
const CXXRecordDecl *ClassDecl,
|
||||
const CXXRecordDecl *BaseClassDecl, QualType Ty) {
|
||||
if (ClassDecl) {
|
||||
Dest = AddressCXXOfBaseClass(Dest, ClassDecl, BaseClassDecl);
|
||||
Src = AddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl) ;
|
||||
Dest = GetAddressCXXOfBaseClass(Dest, ClassDecl, BaseClassDecl,
|
||||
/*NullCheckValue=*/false);
|
||||
Src = GetAddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl,
|
||||
/*NullCheckValue=*/false);
|
||||
}
|
||||
if (BaseClassDecl->hasTrivialCopyConstructor()) {
|
||||
EmitAggregateCopy(Dest, Src, Ty);
|
||||
|
@ -1535,8 +1537,10 @@ void CodeGenFunction::EmitClassCopyAssignment(
|
|||
const CXXRecordDecl *BaseClassDecl,
|
||||
QualType Ty) {
|
||||
if (ClassDecl) {
|
||||
Dest = AddressCXXOfBaseClass(Dest, ClassDecl, BaseClassDecl);
|
||||
Src = AddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl) ;
|
||||
Dest = GetAddressCXXOfBaseClass(Dest, ClassDecl, BaseClassDecl,
|
||||
/*NullCheckValue=*/false);
|
||||
Src = GetAddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl,
|
||||
/*NullCheckValue=*/false);
|
||||
}
|
||||
if (BaseClassDecl->hasTrivialCopyAssignment()) {
|
||||
EmitAggregateCopy(Dest, Src, Ty);
|
||||
|
@ -1774,8 +1778,9 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD) {
|
|||
Type *BaseType = Member->getBaseClass();
|
||||
CXXRecordDecl *BaseClassDecl =
|
||||
cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl());
|
||||
llvm::Value *V = AddressCXXOfBaseClass(LoadOfThis, ClassDecl,
|
||||
BaseClassDecl);
|
||||
llvm::Value *V = GetAddressCXXOfBaseClass(LoadOfThis, ClassDecl,
|
||||
BaseClassDecl,
|
||||
/*NullCheckValue=*/false);
|
||||
EmitCXXConstructorCall(Member->getConstructor(),
|
||||
Ctor_Complete, V,
|
||||
Member->const_arg_begin(),
|
||||
|
@ -1858,8 +1863,9 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD) {
|
|||
if (CXXConstructorDecl *BaseCX =
|
||||
BaseClassDecl->getDefaultConstructor(getContext())) {
|
||||
LoadOfThis = LoadCXXThis();
|
||||
llvm::Value *V = AddressCXXOfBaseClass(LoadOfThis, ClassDecl,
|
||||
BaseClassDecl);
|
||||
llvm::Value *V = GetAddressCXXOfBaseClass(LoadOfThis, ClassDecl,
|
||||
BaseClassDecl,
|
||||
/*NullCheckValue=*/false);
|
||||
EmitCXXConstructorCall(BaseCX, Ctor_Complete, V, 0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1954,8 +1960,9 @@ void CodeGenFunction::EmitDtorEpilogue(const CXXDestructorDecl *DD) {
|
|||
CXXRecordDecl *BaseClassDecl = cast<CXXRecordDecl>(RT->getDecl());
|
||||
if (BaseClassDecl->hasTrivialDestructor())
|
||||
continue;
|
||||
llvm::Value *V = AddressCXXOfBaseClass(LoadCXXThis(),
|
||||
ClassDecl,BaseClassDecl);
|
||||
llvm::Value *V = GetAddressCXXOfBaseClass(LoadCXXThis(),
|
||||
ClassDecl, BaseClassDecl,
|
||||
/*NullCheckValue=*/false);
|
||||
EmitCXXDestructorCall(BaseClassDecl->getDestructor(getContext()),
|
||||
Dtor_Complete, V);
|
||||
}
|
||||
|
@ -2022,8 +2029,9 @@ void CodeGenFunction::EmitDtorEpilogue(const CXXDestructorDecl *DD) {
|
|||
return;
|
||||
for (int i = DestructedBases.size() -1; i >= 0; --i) {
|
||||
CXXRecordDecl *BaseClassDecl = DestructedBases[i];
|
||||
llvm::Value *V = AddressCXXOfBaseClass(LoadCXXThis(),
|
||||
ClassDecl,BaseClassDecl);
|
||||
llvm::Value *V = GetAddressCXXOfBaseClass(LoadCXXThis(),
|
||||
ClassDecl,BaseClassDecl,
|
||||
/*NullCheckValue=*/false);
|
||||
EmitCXXDestructorCall(BaseClassDecl->getDestructor(getContext()),
|
||||
Dtor_Complete, V);
|
||||
}
|
||||
|
|
|
@ -468,11 +468,13 @@ Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType,
|
|||
// The source value may be an integer, or a pointer.
|
||||
if (isa<llvm::PointerType>(Src->getType())) {
|
||||
// Some heavy lifting for derived to base conversion.
|
||||
// FIXME: This should be handled by EmitCast.
|
||||
if (const CXXRecordDecl *ClassDecl =
|
||||
SrcType->getCXXRecordDeclForPointerType())
|
||||
if (const CXXRecordDecl *BaseClassDecl =
|
||||
DstType->getCXXRecordDeclForPointerType())
|
||||
Src = CGF.AddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl);
|
||||
Src = CGF.GetAddressCXXOfBaseClass(Src, ClassDecl, BaseClassDecl,
|
||||
/*NullCheckValue=*/false);
|
||||
return Builder.CreateBitCast(Src, DstTy, "conv");
|
||||
}
|
||||
assert(SrcType->isIntegerType() && "Not ptr->ptr or int->ptr conversion?");
|
||||
|
|
|
@ -573,13 +573,14 @@ public:
|
|||
/// generating code for an C++ member function.
|
||||
llvm::Value *LoadCXXThis();
|
||||
|
||||
/// AddressCXXOfBaseClass - This function will add the necessary delta
|
||||
/// GetAddressCXXOfBaseClass - This function will add the necessary delta
|
||||
/// to the load of 'this' and returns address of the base class.
|
||||
// FIXME. This currently only does a derived to non-virtual base conversion.
|
||||
// Other kinds of conversions will come later.
|
||||
llvm::Value *AddressCXXOfBaseClass(llvm::Value *ThisValue,
|
||||
const CXXRecordDecl *ClassDecl,
|
||||
const CXXRecordDecl *BaseClassDecl);
|
||||
llvm::Value *GetAddressCXXOfBaseClass(llvm::Value *BaseValue,
|
||||
const CXXRecordDecl *ClassDecl,
|
||||
const CXXRecordDecl *BaseClassDecl,
|
||||
bool NullCheckValue);
|
||||
|
||||
void EmitClassAggrMemberwiseCopy(llvm::Value *DestValue,
|
||||
llvm::Value *SrcValue,
|
||||
|
|
Loading…
Reference in New Issue