forked from OSchip/llvm-project
Simplify getting CXXRecordDecl from a base iterator
llvm-svn: 185438
This commit is contained in:
parent
94d6195fdf
commit
7f55a455d1
|
@ -224,8 +224,7 @@ static BaseOffset ComputeBaseOffset(ASTContext &Context,
|
|||
if (Element.Base->isVirtual()) {
|
||||
NonVirtualStart = I;
|
||||
QualType VBaseType = Element.Base->getType();
|
||||
VirtualBase =
|
||||
cast<CXXRecordDecl>(VBaseType->getAs<RecordType>()->getDecl());
|
||||
VirtualBase = VBaseType->getAsCXXRecordDecl();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -237,8 +236,7 @@ static BaseOffset ComputeBaseOffset(ASTContext &Context,
|
|||
// Check the base class offset.
|
||||
const ASTRecordLayout &Layout = Context.getASTRecordLayout(Element.Class);
|
||||
|
||||
const RecordType *BaseType = Element.Base->getType()->getAs<RecordType>();
|
||||
const CXXRecordDecl *Base = cast<CXXRecordDecl>(BaseType->getDecl());
|
||||
const CXXRecordDecl *Base = Element.Base->getType()->getAsCXXRecordDecl();
|
||||
|
||||
NonVirtualOffset += Layout.getBaseClassOffset(Base);
|
||||
}
|
||||
|
@ -341,8 +339,7 @@ FinalOverriders::ComputeBaseOffsets(BaseSubobject Base, bool IsVirtual,
|
|||
// Traverse our bases.
|
||||
for (CXXRecordDecl::base_class_const_iterator I = RD->bases_begin(),
|
||||
E = RD->bases_end(); I != E; ++I) {
|
||||
const CXXRecordDecl *BaseDecl =
|
||||
cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
|
||||
const CXXRecordDecl *BaseDecl = I->getType()->getAsCXXRecordDecl();
|
||||
|
||||
CharUnits BaseOffset;
|
||||
CharUnits BaseOffsetInLayoutClass;
|
||||
|
@ -379,8 +376,7 @@ void FinalOverriders::dump(raw_ostream &Out, BaseSubobject Base,
|
|||
|
||||
for (CXXRecordDecl::base_class_const_iterator I = RD->bases_begin(),
|
||||
E = RD->bases_end(); I != E; ++I) {
|
||||
const CXXRecordDecl *BaseDecl =
|
||||
cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
|
||||
const CXXRecordDecl *BaseDecl = I->getType()->getAsCXXRecordDecl();
|
||||
|
||||
// Ignore bases that don't have any virtual member functions.
|
||||
if (!BaseDecl->isPolymorphic())
|
||||
|
@ -725,8 +721,7 @@ void VCallAndVBaseOffsetBuilder::AddVCallOffsets(BaseSubobject Base,
|
|||
if (I->isVirtual())
|
||||
continue;
|
||||
|
||||
const CXXRecordDecl *BaseDecl =
|
||||
cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
|
||||
const CXXRecordDecl *BaseDecl = I->getType()->getAsCXXRecordDecl();
|
||||
if (BaseDecl == PrimaryBase)
|
||||
continue;
|
||||
|
||||
|
@ -748,8 +743,7 @@ VCallAndVBaseOffsetBuilder::AddVBaseOffsets(const CXXRecordDecl *RD,
|
|||
// Add vbase offsets.
|
||||
for (CXXRecordDecl::base_class_const_iterator I = RD->bases_begin(),
|
||||
E = RD->bases_end(); I != E; ++I) {
|
||||
const CXXRecordDecl *BaseDecl =
|
||||
cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
|
||||
const CXXRecordDecl *BaseDecl = I->getType()->getAsCXXRecordDecl();
|
||||
|
||||
// Check if this is a virtual base that we haven't visited before.
|
||||
if (I->isVirtual() && VisitedVirtualBases.insert(BaseDecl)) {
|
||||
|
@ -1772,8 +1766,7 @@ void VTableBuilder::LayoutSecondaryVTables(BaseSubobject Base,
|
|||
if (I->isVirtual())
|
||||
continue;
|
||||
|
||||
const CXXRecordDecl *BaseDecl =
|
||||
cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
|
||||
const CXXRecordDecl *BaseDecl = I->getType()->getAsCXXRecordDecl();
|
||||
|
||||
// Ignore bases that don't have a vtable.
|
||||
if (!BaseDecl->isDynamicClass())
|
||||
|
@ -1849,8 +1842,7 @@ VTableBuilder::DeterminePrimaryVirtualBases(const CXXRecordDecl *RD,
|
|||
// Traverse bases, looking for more primary virtual bases.
|
||||
for (CXXRecordDecl::base_class_const_iterator I = RD->bases_begin(),
|
||||
E = RD->bases_end(); I != E; ++I) {
|
||||
const CXXRecordDecl *BaseDecl =
|
||||
cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
|
||||
const CXXRecordDecl *BaseDecl = I->getType()->getAsCXXRecordDecl();
|
||||
|
||||
CharUnits BaseOffsetInLayoutClass;
|
||||
|
||||
|
@ -1881,8 +1873,7 @@ VTableBuilder::LayoutVTablesForVirtualBases(const CXXRecordDecl *RD,
|
|||
// the classes for which they are primary).
|
||||
for (CXXRecordDecl::base_class_const_iterator I = RD->bases_begin(),
|
||||
E = RD->bases_end(); I != E; ++I) {
|
||||
const CXXRecordDecl *BaseDecl =
|
||||
cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
|
||||
const CXXRecordDecl *BaseDecl = I->getType()->getAsCXXRecordDecl();
|
||||
|
||||
// Check if this base needs a vtable. (If it's virtual, not a primary base
|
||||
// of some other class, and we haven't visited it before).
|
||||
|
@ -2362,9 +2353,8 @@ void VTableContext::ComputeVTableRelatedInformation(const CXXRecordDecl *RD) {
|
|||
if (!RD->getNumVBases())
|
||||
return;
|
||||
|
||||
const RecordType *VBaseRT =
|
||||
RD->vbases_begin()->getType()->getAs<RecordType>();
|
||||
const CXXRecordDecl *VBase = cast<CXXRecordDecl>(VBaseRT->getDecl());
|
||||
const CXXRecordDecl *VBase =
|
||||
RD->vbases_begin()->getType()->getAsCXXRecordDecl();
|
||||
|
||||
if (VirtualBaseClassOffsetOffsets.count(std::make_pair(RD, VBase)))
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue