Rename AddressCXXOfBaseClass to GetAddressCXXOfBaseClass. Add a NullCheckValue argument (currently unused).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81606 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj
index 58499fb..e5275dc 100644
--- a/clang.xcodeproj/project.pbxproj
+++ b/clang.xcodeproj/project.pbxproj
@@ -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>"; };
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index c3c4044..4932692 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -1498,8 +1498,10 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
}
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index aecf955..ef323c1 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -468,11 +468,13 @@
// 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?");
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index a81f67b..89e478b 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -573,13 +573,14 @@
/// 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,