From 4d0729a7cc6990ff95f82dfacb5a650f0d387fa2 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 27 Feb 2010 19:00:53 +0000 Subject: Figured out why the test was failing, this will hopefully fix it. llvm-svn: 97336 --- clang/lib/CodeGen/CGVtable.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp index 8e9e0655e8d..399b921b52e 100644 --- a/clang/lib/CodeGen/CGVtable.cpp +++ b/clang/lib/CodeGen/CGVtable.cpp @@ -1296,6 +1296,8 @@ OverridesMethodInBases(const CXXMethodDecl *MD, } void VtableBuilder::ComputeThisAdjustments() { + std::map SortedThisAdjustments; + // Now go through the method info map and see if any of the methods need // 'this' pointer adjustments. for (MethodInfoMapTy::const_iterator I = MethodInfoMap.begin(), @@ -1338,17 +1340,21 @@ void VtableBuilder::ComputeThisAdjustments() { ThisAdjustmentOffset); // Add it. - ThisAdjustments.push_back(std::make_pair(VtableIndex, ThisAdjustment)); + SortedThisAdjustments.insert(std::make_pair(VtableIndex, ThisAdjustment)); if (isa(MD)) { // Add an adjustment for the deleting destructor as well. - ThisAdjustments.push_back(std::make_pair(VtableIndex + 1, - ThisAdjustment)); + SortedThisAdjustments.insert(std::make_pair(VtableIndex + 1, + ThisAdjustment)); } } /// Clear the method info map. MethodInfoMap.clear(); + + // Add the sorted elements. + ThisAdjustments.append(SortedThisAdjustments.begin(), + SortedThisAdjustments.end()); } VtableBuilder::ReturnAdjustment -- cgit v1.2.3