]> granicus.if.org Git - clang/commitdiff
Figured out why the test was failing, this will hopefully fix it.
authorAnders Carlsson <andersca@mac.com>
Sat, 27 Feb 2010 19:00:53 +0000 (19:00 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 27 Feb 2010 19:00:53 +0000 (19:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97336 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGVtable.cpp
test/CodeGenCXX/vtable-layout-abi-examples.cpp

index 8e9e0655e8d2033eceb3488e981cbc2a2087761b..399b921b52e921af24e7991f3079c506192da16d 100644 (file)
@@ -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 
index cec7a5cf71bdb021af23f9b0a80cc5e58cca1d67..2c6b7a48ccfe990a54e3fb0d7f5917c1f74360da 100644 (file)
@@ -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/