Figured out why the test was failing, this will hopefully fix it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97336 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 8e9e065..399b921 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -1296,6 +1296,8 @@
}
void VtableBuilder::ComputeThisAdjustments() {
+ std::map<uint64_t, ThisAdjustment> 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 @@
ThisAdjustmentOffset);
// Add it.
- ThisAdjustments.push_back(std::make_pair(VtableIndex, ThisAdjustment));
+ SortedThisAdjustments.insert(std::make_pair(VtableIndex, ThisAdjustment));
if (isa<CXXDestructorDecl>(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