[cfe-commits] r112816 - /cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
John McCall
rjmccall at apple.com
Thu Sep 2 03:25:58 PDT 2010
Author: rjmccall
Date: Thu Sep 2 05:25:57 2010
New Revision: 112816
URL: http://llvm.org/viewvc/llvm-project?rev=112816&view=rev
Log:
Simplify some random accesses to the ASTContext from the ABI classes.
Modified:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=112816&r1=112815&r2=112816&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu Sep 2 05:25:57 2010
@@ -41,7 +41,7 @@
// It's a little silly for us to cache this.
const llvm::IntegerType *getPtrDiffTy() {
if (!PtrDiffTy) {
- QualType T = CGM.getContext().getPointerDiffType();
+ QualType T = getContext().getPointerDiffType();
const llvm::Type *Ty = CGM.getTypes().ConvertTypeRecursive(T);
PtrDiffTy = cast<llvm::IntegerType>(Ty);
}
@@ -52,7 +52,7 @@
public:
ItaniumCXXABI(CodeGen::CodeGenModule &CGM, bool IsARM = false) :
- CGCXXABI(CGM), PtrDiffTy(0), MangleCtx(CGM.getContext(), CGM.getDiags()),
+ CGCXXABI(CGM), PtrDiffTy(0), MangleCtx(getContext(), CGM.getDiags()),
IsARM(IsARM) { }
CodeGen::MangleContext &getMangleContext() {
@@ -495,7 +495,7 @@
// A pointer to data member is an offset from the base address of
// the class object containing it, represented as a ptrdiff_t
- QualType ClassType = CGM.getContext().getTypeDeclType(FD->getParent());
+ QualType ClassType = getContext().getTypeDeclType(FD->getParent());
const llvm::StructType *ClassLTy =
cast<llvm::StructType>(CGM.getTypes().ConvertType(ClassType));
@@ -521,7 +521,7 @@
// FIXME: We shouldn't use / 8 here.
uint64_t PointerWidthInBytes =
- CGM.getContext().Target.getPointerWidth(0) / 8;
+ getContext().Target.getPointerWidth(0) / 8;
uint64_t VTableOffset = (Index * PointerWidthInBytes);
if (IsARM) {
@@ -686,7 +686,7 @@
CXXCtorType Type,
CanQualType &ResTy,
llvm::SmallVectorImpl<CanQualType> &ArgTys) {
- ASTContext &Context = CGM.getContext();
+ ASTContext &Context = getContext();
// 'this' is already there.
@@ -710,7 +710,7 @@
CXXDtorType Type,
CanQualType &ResTy,
llvm::SmallVectorImpl<CanQualType> &ArgTys) {
- ASTContext &Context = CGM.getContext();
+ ASTContext &Context = getContext();
// 'this' is already there.
@@ -742,7 +742,7 @@
// Check if we need a VTT parameter as well.
if (CodeGenVTables::needsVTTParameter(CGF.CurGD)) {
- ASTContext &Context = CGF.getContext();
+ ASTContext &Context = getContext();
// FIXME: avoid the fake decl
QualType T = Context.getPointerType(Context.VoidPtrTy);
@@ -800,7 +800,7 @@
/************************** Array allocation cookies **************************/
bool ItaniumCXXABI::NeedsArrayCookie(QualType ElementType) {
- ElementType = CGM.getContext().getBaseElementType(ElementType);
+ ElementType = getContext().getBaseElementType(ElementType);
const RecordType *RT = ElementType->getAs<RecordType>();
if (!RT) return false;
@@ -819,7 +819,7 @@
// FIXME: what exactly is this code supposed to do if there's an
// ambiguity? That's possible with using declarations.
DeclarationName OpName =
- CGM.getContext().DeclarationNames.getCXXOperatorName(OO_Array_Delete);
+ getContext().DeclarationNames.getCXXOperatorName(OO_Array_Delete);
DeclContext::lookup_const_iterator Op, OpEnd;
for (llvm::tie(Op, OpEnd) = RD->lookup(OpName); Op != OpEnd; ++Op) {
const CXXMethodDecl *Delete =
@@ -850,7 +850,7 @@
return CharUnits::Zero();
// Padding is the maximum of sizeof(size_t) and alignof(ElementType)
- ASTContext &Ctx = CGM.getContext();
+ ASTContext &Ctx = getContext();
return std::max(Ctx.getTypeSizeInChars(Ctx.getSizeType()),
Ctx.getTypeAlignInChars(ElementType));
}
@@ -863,7 +863,7 @@
unsigned AS = cast<llvm::PointerType>(NewPtr->getType())->getAddressSpace();
- ASTContext &Ctx = CGM.getContext();
+ ASTContext &Ctx = getContext();
QualType SizeTy = Ctx.getSizeType();
CharUnits SizeSize = Ctx.getTypeSizeInChars(SizeTy);
@@ -908,12 +908,12 @@
return;
}
- QualType SizeTy = CGF.getContext().getSizeType();
- CharUnits SizeSize = CGF.getContext().getTypeSizeInChars(SizeTy);
+ QualType SizeTy = getContext().getSizeType();
+ CharUnits SizeSize = getContext().getTypeSizeInChars(SizeTy);
const llvm::Type *SizeLTy = CGF.ConvertType(SizeTy);
CookieSize
- = std::max(SizeSize, CGF.getContext().getTypeAlignInChars(ElementType));
+ = std::max(SizeSize, getContext().getTypeAlignInChars(ElementType));
CharUnits NumElementsOffset = CookieSize - SizeSize;
@@ -956,7 +956,7 @@
unsigned AS = cast<llvm::PointerType>(NewPtr->getType())->getAddressSpace();
- ASTContext &Ctx = CGM.getContext();
+ ASTContext &Ctx = getContext();
CharUnits SizeSize = Ctx.getTypeSizeInChars(Ctx.getSizeType());
const llvm::IntegerType *SizeTy =
cast<llvm::IntegerType>(CGF.ConvertType(Ctx.getSizeType()));
@@ -999,8 +999,8 @@
return;
}
- QualType SizeTy = CGF.getContext().getSizeType();
- CharUnits SizeSize = CGF.getContext().getTypeSizeInChars(SizeTy);
+ QualType SizeTy = getContext().getSizeType();
+ CharUnits SizeSize = getContext().getTypeSizeInChars(SizeTy);
const llvm::Type *SizeLTy = CGF.ConvertType(SizeTy);
// The cookie size is always 2 * sizeof(size_t).
More information about the cfe-commits
mailing list