aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-02-27 19:00:53 +0000
committerAnders Carlsson <andersca@mac.com>2010-02-27 19:00:53 +0000
commite54d1c12d7a53bea988e2b880b66faf04410c1be (patch)
tree80e584ac6ce9ef5c9292a741744c9dafc6b9b791
parent8bc68f7a29f94446852f4d709115a7f4e6765f7a (diff)
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
-rw-r--r--lib/CodeGen/CGVtable.cpp12
-rw-r--r--test/CodeGenCXX/vtable-layout-abi-examples.cpp1
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index 8e9e0655e8..399b921b52 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -1296,6 +1296,8 @@ OverridesMethodInBases(const CXXMethodDecl *MD,
}
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 @@ void VtableBuilder::ComputeThisAdjustments() {
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
diff --git a/test/CodeGenCXX/vtable-layout-abi-examples.cpp b/test/CodeGenCXX/vtable-layout-abi-examples.cpp
index cec7a5cf71..2c6b7a48cc 100644
--- a/test/CodeGenCXX/vtable-layout-abi-examples.cpp
+++ b/test/CodeGenCXX/vtable-layout-abi-examples.cpp
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm-only -fdump-vtable-layouts 2>&1 | FileCheck %s
-// XFAIL: *
/// Examples from the Itanium C++ ABI specification.
/// http://www.codesourcery.com/public/cxx-abi/