]> granicus.if.org Git - clang/commitdiff
Move code off the primary base info iterator. No functionality change.
authorAnders Carlsson <andersca@mac.com>
Wed, 24 Nov 2010 23:04:03 +0000 (23:04 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 24 Nov 2010 23:04:03 +0000 (23:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120132 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGVTables.cpp

index 066b20c837547308d13bedf40c0488df912dfe5a..c40f437c6ab7290a9bc7b07e90ca53bc87b1e336 100644 (file)
@@ -2240,6 +2240,19 @@ void VTableBuilder::dumpLayout(llvm::raw_ostream& Out) {
   
 }
 
+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 @@ void CodeGenVTables::ComputeMethodVTableIndices(const CXXRecordDecl *RD) {
   // 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;