diff options
| author | Anders Carlsson <andersca@mac.com> | 2010-02-02 19:58:43 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2010-02-02 19:58:43 +0000 |
| commit | 5dc86337fb6f17a73533952964f9d956461a7716 (patch) | |
| tree | 0cb69a1cd8090ed5f5894429fb3b7aa698154af7 /clang/lib/CodeGen/CGClass.cpp | |
| parent | 29e0702dc82956bbaf63121b93b2b19273d70d40 (diff) | |
| download | bcm5719-llvm-5dc86337fb6f17a73533952964f9d956461a7716.tar.gz bcm5719-llvm-5dc86337fb6f17a73533952964f9d956461a7716.zip | |
Set the correct vtable pointers _before_ generating code for any member initializers. Fixes about ~2000 clang/LLVM tests in the clang-on-clang build.
llvm-svn: 95116
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 01b3934c4c0..8362945e1ed 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -861,6 +861,8 @@ static void EmitMemberInitializer(CodeGenFunction &CGF, void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD, CXXCtorType CtorType) { const CXXRecordDecl *ClassDecl = CD->getParent(); + + llvm::SmallVector<CXXBaseOrMemberInitializer *, 8> MemberInitializers; // FIXME: Add vbase initialization @@ -875,14 +877,17 @@ void CodeGenFunction::EmitCtorPrologue(const CXXConstructorDecl *CD, if (Member->isBaseInitializer()) EmitBaseInitializer(*this, ClassDecl, Member, CtorType); else - EmitMemberInitializer(*this, ClassDecl, Member); - - // Pop any live temporaries that the initializers might have pushed. - while (!LiveTemporaries.empty()) - PopCXXTemporary(); + MemberInitializers.push_back(Member); } InitializeVtablePtrs(ClassDecl); + + for (unsigned I = 0, E = MemberInitializers.size(); I != E; ++I) { + assert(LiveTemporaries.empty() && + "Should not have any live temporaries at initializer start!"); + + EmitMemberInitializer(*this, ClassDecl, MemberInitializers[I]); + } } /// EmitDtorEpilogue - Emit all code that comes at the end of class's |

