Move code off the primary base info iterator. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120132 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp
index 066b20c..c40f437 100644
--- a/lib/CodeGen/CGVTables.cpp
+++ b/lib/CodeGen/CGVTables.cpp
@@ -2240,6 +2240,19 @@
}
+static void
+CollectPrimaryBases(const CXXRecordDecl *RD, ASTContext &Context,
+ VTableBuilder::PrimaryBasesSetVectorTy &PrimaryBases) {
+ while (RD) {
+ const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
+ const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
+ if (PrimaryBase)
+ PrimaryBases.insert(PrimaryBase);
+
+ RD = PrimaryBase;
+ }
+}
+
void CodeGenVTables::ComputeMethodVTableIndices(const CXXRecordDecl *RD) {
// Itanium C++ ABI 2.5.2:
@@ -2268,10 +2281,7 @@
// Collect all the primary bases, so we can check whether methods override
// a method from the base.
VTableBuilder::PrimaryBasesSetVectorTy PrimaryBases;
- for (ASTRecordLayout::primary_base_info_iterator
- I = Layout.primary_base_begin(), E = Layout.primary_base_end();
- I != E; ++I)
- PrimaryBases.insert((*I).getBase());
+ CollectPrimaryBases(RD, CGM.getContext(), PrimaryBases);
const CXXDestructorDecl *ImplicitVirtualDtor = 0;