diff options
| author | Anders Carlsson <andersca@mac.com> | 2011-04-10 18:00:32 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2011-04-10 18:00:32 +0000 |
| commit | e5ec21c977f3f0c797e3d9c903d78b176df713fb (patch) | |
| tree | c8265ec28558e12ffd589e75744744bdef85ed90 /clang/lib/CodeGen | |
| parent | 1444d85b5a41c7ab9a871df5a3cab9a14f6f7bbb (diff) | |
| download | bcm5719-llvm-e5ec21c977f3f0c797e3d9c903d78b176df713fb.tar.gz bcm5719-llvm-e5ec21c977f3f0c797e3d9c903d78b176df713fb.zip | |
Change CollectPrimaryBases to collect the bases in the right order. Fixes one half of PR9660.
llvm-svn: 129252
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGVTables.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index bc97b7463e8..678b115753d 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -2306,14 +2306,16 @@ 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); + const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD); + const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase(); - RD = PrimaryBase; - } + if (!PrimaryBase) + return; + + CollectPrimaryBases(PrimaryBase, Context, PrimaryBases); + + if (!PrimaryBases.insert(PrimaryBase)) + assert(false && "Found a duplicate primary base!"); } void CodeGenVTables::ComputeMethodVTableIndices(const CXXRecordDecl *RD) { |

