From: Anders Carlsson Date: Mon, 29 Mar 2010 01:28:05 +0000 (+0000) Subject: Make sure to sort the vtable thunks by their vtable index :) With this we now pass... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aed924e9f210169c9a5b0ca30099fd2f479f2637;p=clang Make sure to sort the vtable thunks by their vtable index :) With this we now pass the test from http://www.codesourcery.com/public/cxx-abi/abi-examples.html#vtable-ctor successfully. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99792 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp index 804c684361..1c94a4e73e 100644 --- a/lib/CodeGen/CGVtable.cpp +++ b/lib/CodeGen/CGVtable.cpp @@ -4212,6 +4212,9 @@ CodeGenVTables::GenerateConstructionVTable(const CXXRecordDecl *RD, VTableThunks.append(Builder.vtable_thunks_begin(), Builder.vtable_thunks_end()); + // Sort them. + std::sort(VTableThunks.begin(), VTableThunks.end()); + // Create and set the initializer. llvm::Constant *Init = CreateVTableInitializer(Base.getBase(),