[cfe-commits] r99184 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Anders Carlsson andersca at mac.com
Mon Mar 22 09:30:44 PDT 2010


Author: andersca
Date: Mon Mar 22 11:30:44 2010
New Revision: 99184

URL: http://llvm.org/viewvc/llvm-project?rev=99184&view=rev
Log:
Add less than operators to ThisAdjustment, ReturnAdjustment and ThunkInfo. Sort the thunks before dumping them.

Modified:
    cfe/trunk/lib/CodeGen/CGVtable.cpp

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=99184&r1=99183&r2=99184&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Mon Mar 22 11:30:44 2010
@@ -1154,6 +1154,15 @@
       return LHS.NonVirtual == RHS.NonVirtual && 
         LHS.VBaseOffsetOffset == RHS.VBaseOffsetOffset;
     }
+    
+    friend bool operator<(const ReturnAdjustment &LHS,
+                          const ReturnAdjustment &RHS) {
+      if (LHS.NonVirtual < RHS.NonVirtual)
+        return true;
+      
+      return LHS.NonVirtual == RHS.NonVirtual && 
+        LHS.VBaseOffsetOffset < RHS.VBaseOffsetOffset;
+    }
   };
   
   /// MethodInfo - Contains information about a method in a vtable.
@@ -1204,6 +1213,16 @@
       return LHS.NonVirtual == RHS.NonVirtual && 
         LHS.VCallOffsetOffset == RHS.VCallOffsetOffset;
     }
+    
+    friend bool operator<(const ThisAdjustment &LHS,
+                          const ThisAdjustment &RHS) {
+      if (LHS.NonVirtual < RHS.NonVirtual)
+        return true;
+      
+      return LHS.NonVirtual == RHS.NonVirtual && 
+        LHS.VCallOffsetOffset < RHS.VCallOffsetOffset;
+    }
+    
   };
   
   /// ThunkInfo - The 'this' pointer adjustment as well as an optional return
@@ -1224,6 +1243,13 @@
       return LHS.This == RHS.This && LHS.Return == RHS.Return;
     }
 
+    friend bool operator<(const ThunkInfo &LHS, const ThunkInfo &RHS) {
+      if (LHS.This < RHS.This)
+        return true;
+      
+      return LHS.This == RHS.This && LHS.Return < RHS.Return;
+    }
+    
     bool isEmpty() const { return This.isEmpty() && Return.isEmpty(); }
   };
   
@@ -2296,7 +2322,9 @@
          I != E; ++I) {
       const std::string &MethodName = I->first;
       const CXXMethodDecl *MD = I->second;
-      const llvm::SmallVector<ThunkInfo, 1> &ThunksVector = MethodThunks[MD];
+
+      llvm::SmallVector<ThunkInfo, 1> ThunksVector = MethodThunks[MD];
+      std::sort(ThunksVector.begin(), ThunksVector.end());
 
       Out << "Thunks for '" << MethodName << "' (" << ThunksVector.size();
       Out << (ThunksVector.size() == 1 ? " entry" : " entries") << ").\n";





More information about the cfe-commits mailing list