forked from OSchip/llvm-project
Make the 'for (auto ...)' names more readable
llvm-svn: 204787
This commit is contained in:
parent
dd0a27664d
commit
1523c610c9
|
@ -338,12 +338,12 @@ FinalOverriders::ComputeBaseOffsets(BaseSubobject Base, bool IsVirtual,
|
|||
OffsetInLayoutClass;
|
||||
|
||||
// Traverse our bases.
|
||||
for (const auto &I : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = I.getType()->getAsCXXRecordDecl();
|
||||
for (const auto &B : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
|
||||
|
||||
CharUnits BaseOffset;
|
||||
CharUnits BaseOffsetInLayoutClass;
|
||||
if (I.isVirtual()) {
|
||||
if (B.isVirtual()) {
|
||||
// Check if we've visited this virtual base before.
|
||||
if (SubobjectOffsets.count(std::make_pair(BaseDecl, 0)))
|
||||
continue;
|
||||
|
@ -363,7 +363,7 @@ FinalOverriders::ComputeBaseOffsets(BaseSubobject Base, bool IsVirtual,
|
|||
}
|
||||
|
||||
ComputeBaseOffsets(BaseSubobject(BaseDecl, BaseOffset),
|
||||
I.isVirtual(), BaseOffsetInLayoutClass,
|
||||
B.isVirtual(), BaseOffsetInLayoutClass,
|
||||
SubobjectOffsets, SubobjectLayoutClassOffsets,
|
||||
SubobjectCounts);
|
||||
}
|
||||
|
@ -374,15 +374,15 @@ void FinalOverriders::dump(raw_ostream &Out, BaseSubobject Base,
|
|||
const CXXRecordDecl *RD = Base.getBase();
|
||||
const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
|
||||
|
||||
for (const auto &I : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = I.getType()->getAsCXXRecordDecl();
|
||||
for (const auto &B : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
|
||||
|
||||
// Ignore bases that don't have any virtual member functions.
|
||||
if (!BaseDecl->isPolymorphic())
|
||||
continue;
|
||||
|
||||
CharUnits BaseOffset;
|
||||
if (I.isVirtual()) {
|
||||
if (B.isVirtual()) {
|
||||
if (!VisitedVirtualBases.insert(BaseDecl)) {
|
||||
// We've visited this base before.
|
||||
continue;
|
||||
|
@ -714,11 +714,11 @@ void VCallAndVBaseOffsetBuilder::AddVCallOffsets(BaseSubobject Base,
|
|||
}
|
||||
|
||||
// And iterate over all non-virtual bases (ignoring the primary base).
|
||||
for (const auto &I : RD->bases()) {
|
||||
if (I.isVirtual())
|
||||
for (const auto &B : RD->bases()) {
|
||||
if (B.isVirtual())
|
||||
continue;
|
||||
|
||||
const CXXRecordDecl *BaseDecl = I.getType()->getAsCXXRecordDecl();
|
||||
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
|
||||
if (BaseDecl == PrimaryBase)
|
||||
continue;
|
||||
|
||||
|
@ -738,11 +738,11 @@ VCallAndVBaseOffsetBuilder::AddVBaseOffsets(const CXXRecordDecl *RD,
|
|||
Context.getASTRecordLayout(LayoutClass);
|
||||
|
||||
// Add vbase offsets.
|
||||
for (const auto &I : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = I.getType()->getAsCXXRecordDecl();
|
||||
for (const auto &B : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
|
||||
|
||||
// Check if this is a virtual base that we haven't visited before.
|
||||
if (I.isVirtual() && VisitedVirtualBases.insert(BaseDecl)) {
|
||||
if (B.isVirtual() && VisitedVirtualBases.insert(BaseDecl)) {
|
||||
CharUnits Offset =
|
||||
LayoutClassLayout.getVBaseClassOffset(BaseDecl) - OffsetInLayoutClass;
|
||||
|
||||
|
@ -1752,12 +1752,12 @@ ItaniumVTableBuilder::LayoutSecondaryVTables(BaseSubobject Base,
|
|||
const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
|
||||
const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
|
||||
|
||||
for (const auto &I : RD->bases()) {
|
||||
for (const auto &B : RD->bases()) {
|
||||
// Ignore virtual bases, we'll emit them later.
|
||||
if (I.isVirtual())
|
||||
if (B.isVirtual())
|
||||
continue;
|
||||
|
||||
const CXXRecordDecl *BaseDecl = I.getType()->getAsCXXRecordDecl();
|
||||
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
|
||||
|
||||
// Ignore bases that don't have a vtable.
|
||||
if (!BaseDecl->isDynamicClass())
|
||||
|
@ -1830,12 +1830,12 @@ void ItaniumVTableBuilder::DeterminePrimaryVirtualBases(
|
|||
}
|
||||
|
||||
// Traverse bases, looking for more primary virtual bases.
|
||||
for (const auto &I : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = I.getType()->getAsCXXRecordDecl();
|
||||
for (const auto &B : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = B.getType()->getAsCXXRecordDecl();
|
||||
|
||||
CharUnits BaseOffsetInLayoutClass;
|
||||
|
||||
if (I.isVirtual()) {
|
||||
if (B.isVirtual()) {
|
||||
if (!VBases.insert(BaseDecl))
|
||||
continue;
|
||||
|
||||
|
@ -1859,12 +1859,12 @@ void ItaniumVTableBuilder::LayoutVTablesForVirtualBases(
|
|||
// Then come the virtual base virtual tables, also in inheritance graph
|
||||
// order, and again excluding primary bases (which share virtual tables with
|
||||
// the classes for which they are primary).
|
||||
for (const auto &I : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = I.getType()->getAsCXXRecordDecl();
|
||||
for (const auto &B : RD->bases()) {
|
||||
const CXXRecordDecl *BaseDecl = B.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).
|
||||
if (I.isVirtual() && BaseDecl->isDynamicClass() &&
|
||||
if (B.isVirtual() && BaseDecl->isDynamicClass() &&
|
||||
!PrimaryVirtualBases.count(BaseDecl) && VBases.insert(BaseDecl)) {
|
||||
const ASTRecordLayout &MostDerivedClassLayout =
|
||||
Context.getASTRecordLayout(MostDerivedClass);
|
||||
|
@ -3163,9 +3163,9 @@ void MicrosoftVTableContext::computeVTablePaths(bool ForVBTables,
|
|||
// Recursive case: get all the vbtables from our bases and remove anything
|
||||
// that shares a virtual base.
|
||||
llvm::SmallPtrSet<const CXXRecordDecl*, 4> VBasesSeen;
|
||||
for (const auto &I : RD->bases()) {
|
||||
const CXXRecordDecl *Base = I.getType()->getAsCXXRecordDecl();
|
||||
if (I.isVirtual() && VBasesSeen.count(Base))
|
||||
for (const auto &B : RD->bases()) {
|
||||
const CXXRecordDecl *Base = B.getType()->getAsCXXRecordDecl();
|
||||
if (B.isVirtual() && VBasesSeen.count(Base))
|
||||
continue;
|
||||
|
||||
if (!Base->isDynamicClass())
|
||||
|
@ -3202,7 +3202,7 @@ void MicrosoftVTableContext::computeVTablePaths(bool ForVBTables,
|
|||
if (Base == (ForVBTables ? Layout.getBaseSharingVBPtr()
|
||||
: Layout.getPrimaryBase()))
|
||||
P->ReusingBase = RD;
|
||||
if (I.isVirtual())
|
||||
if (B.isVirtual())
|
||||
P->ContainingVBases.push_back(Base);
|
||||
else if (P->ContainingVBases.empty())
|
||||
P->NonVirtualOffset += Layout.getBaseClassOffset(Base);
|
||||
|
@ -3217,9 +3217,10 @@ void MicrosoftVTableContext::computeVTablePaths(bool ForVBTables,
|
|||
|
||||
// After visiting any direct base, we've transitively visited all of its
|
||||
// morally virtual bases.
|
||||
for (const auto &I : Base->vbases())
|
||||
VBasesSeen.insert(I.getType()->getAsCXXRecordDecl());
|
||||
if (I.isVirtual())
|
||||
for (const auto &VB : Base->vbases())
|
||||
VBasesSeen.insert(VB.getType()->getAsCXXRecordDecl());
|
||||
|
||||
if (B.isVirtual())
|
||||
VBasesSeen.insert(Base);
|
||||
}
|
||||
|
||||
|
@ -3304,9 +3305,9 @@ void MicrosoftVTableContext::computeVTableRelatedInformation(
|
|||
VTableThunks.size(), VTableThunks.data(), EmptyAddressPointsMap, true);
|
||||
Thunks.insert(Builder.thunks_begin(), Builder.thunks_end());
|
||||
|
||||
for (const auto &I : Builder.vtable_locations()) {
|
||||
GlobalDecl GD = I.first;
|
||||
MethodVFTableLocation NewLoc = I.second;
|
||||
for (const auto &Loc : Builder.vtable_locations()) {
|
||||
GlobalDecl GD = Loc.first;
|
||||
MethodVFTableLocation NewLoc = Loc.second;
|
||||
auto M = NewMethodLocations.find(GD);
|
||||
if (M == NewMethodLocations.end() || NewLoc < M->second)
|
||||
NewMethodLocations[GD] = NewLoc;
|
||||
|
@ -3411,8 +3412,8 @@ const VirtualBaseInfo *MicrosoftVTableContext::computeVBTableRelatedInformation(
|
|||
// New vbases are added to the end of the vbtable.
|
||||
// Skip the self entry and vbases visited in the non-virtual base, if any.
|
||||
unsigned VBTableIndex = 1 + VBI->VBTableIndices.size();
|
||||
for (const auto &I : RD->vbases()) {
|
||||
const CXXRecordDecl *CurVBase = I.getType()->getAsCXXRecordDecl();
|
||||
for (const auto &VB : RD->vbases()) {
|
||||
const CXXRecordDecl *CurVBase = VB.getType()->getAsCXXRecordDecl();
|
||||
if (!VBI->VBTableIndices.count(CurVBase))
|
||||
VBI->VBTableIndices[CurVBase] = VBTableIndex++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue