[cfe-commits] r97336 - in /cfe/trunk: lib/CodeGen/CGVtable.cpp test/CodeGenCXX/vtable-layout-abi-examples.cpp

Anders Carlsson andersca at mac.com
Sat Feb 27 11:00:53 PST 2010


Author: andersca
Date: Sat Feb 27 13:00:53 2010
New Revision: 97336

URL: http://llvm.org/viewvc/llvm-project?rev=97336&view=rev
Log:
Figured out why the test was failing, this will hopefully fix it.

Modified:
    cfe/trunk/lib/CodeGen/CGVtable.cpp
    cfe/trunk/test/CodeGenCXX/vtable-layout-abi-examples.cpp

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=97336&r1=97335&r2=97336&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Sat Feb 27 13:00:53 2010
@@ -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 

Modified: cfe/trunk/test/CodeGenCXX/vtable-layout-abi-examples.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-layout-abi-examples.cpp?rev=97336&r1=97335&r2=97336&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-layout-abi-examples.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/vtable-layout-abi-examples.cpp Sat Feb 27 13:00:53 2010
@@ -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/





More information about the cfe-commits mailing list