r204787 - Make the 'for (auto ...)' names more readable
Timur Iskhodzhanov
timurrrr at google.com
Wed Mar 26 01:22:48 PDT 2014
Author: timurrrr
Date: Wed Mar 26 03:22:48 2014
New Revision: 204787
URL: http://llvm.org/viewvc/llvm-project?rev=204787&view=rev
Log:
Make the 'for (auto ...)' names more readable
Modified:
cfe/trunk/lib/AST/VTableBuilder.cpp
Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=204787&r1=204786&r2=204787&view=diff
==============================================================================
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Wed Mar 26 03:22:48 2014
@@ -338,12 +338,12 @@ FinalOverriders::ComputeBaseOffsets(Base
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(Base
}
ComputeBaseOffsets(BaseSubobject(BaseDecl, BaseOffset),
- I.isVirtual(), BaseOffsetInLayoutClass,
+ B.isVirtual(), BaseOffsetInLayoutClass,
SubobjectOffsets, SubobjectLayoutClassOffsets,
SubobjectCounts);
}
@@ -374,15 +374,15 @@ void FinalOverriders::dump(raw_ostream &
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::AddVCal
}
// 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::AddVBaseOffs
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::LayoutSecondaryVTa
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::DeterminePrim
}
// 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::LayoutVTables
// 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::computeVTab
// 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::computeVTab
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::computeVTab
// 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::computeVTab
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 *MicrosoftVTableCo
// 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++;
}
More information about the cfe-commits
mailing list