[cfe-commits] r99279 - in /cfe/trunk/lib/CodeGen: CGVtable.cpp CGVtable.h

Anders Carlsson andersca at mac.com
Tue Mar 23 08:13:06 PDT 2010


Author: andersca
Date: Tue Mar 23 10:13:06 2010
New Revision: 99279

URL: http://llvm.org/viewvc/llvm-project?rev=99279&view=rev
Log:
Move ReturnAdjustment and ThisAdjustment out into CGVtable.h

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

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=99279&r1=99278&r2=99279&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Tue Mar 23 10:13:06 2010
@@ -1135,36 +1135,6 @@
   /// AddressPoints - Address points for the vtable being built.
   CodeGenVTables::AddressPointsMapTy AddressPoints;
 
-  /// ReturnAdjustment - A return adjustment.
-  struct ReturnAdjustment {
-    /// NonVirtual - The non-virtual adjustment from the derived object to its
-    /// nearest virtual base.
-    int64_t NonVirtual;
-    
-    /// VBaseOffsetOffset - The offset (in bytes), relative to the address point 
-    /// of the virtual base class offset.
-    int64_t VBaseOffsetOffset;
-    
-    ReturnAdjustment() : NonVirtual(0), VBaseOffsetOffset(0) { }
-    
-    bool isEmpty() const { return !NonVirtual && !VBaseOffsetOffset; }
-
-    friend bool operator==(const ReturnAdjustment &LHS, 
-                           const ReturnAdjustment &RHS) {
-      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.
   /// (Used for computing 'this' pointer adjustment thunks.
   struct MethodInfo {
@@ -1194,37 +1164,6 @@
   /// currently building.
   MethodInfoMapTy MethodInfoMap;
   
-  /// ThisAdjustment - A 'this' pointer adjustment thunk.
-  struct ThisAdjustment {
-    /// NonVirtual - The non-virtual adjustment from the derived object to its
-    /// nearest virtual base.
-    int64_t NonVirtual;
-
-    /// VCallOffsetOffset - The offset (in bytes), relative to the address point,
-    /// of the virtual call offset.
-    int64_t VCallOffsetOffset;
-    
-    ThisAdjustment() : NonVirtual(0), VCallOffsetOffset(0) { }
-
-    bool isEmpty() const { return !NonVirtual && !VCallOffsetOffset; }
-
-    friend bool operator==(const ThisAdjustment &LHS, 
-                           const ThisAdjustment &RHS) {
-      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
   /// adjustment for a thunk.
   struct ThunkInfo {
@@ -1489,8 +1428,7 @@
   }
 }
 
-VtableBuilder::ReturnAdjustment 
-VtableBuilder::ComputeReturnAdjustment(BaseOffset Offset) {
+ReturnAdjustment VtableBuilder::ComputeReturnAdjustment(BaseOffset Offset) {
   ReturnAdjustment Adjustment;
   
   if (!Offset.isEmpty()) {
@@ -1570,7 +1508,7 @@
   return BaseOffset();
 }
   
-VtableBuilder::ThisAdjustment 
+ThisAdjustment 
 VtableBuilder::ComputeThisAdjustment(const CXXMethodDecl *MD, 
                                      uint64_t BaseOffsetInLayoutClass,
                                      FinalOverriders::OverriderInfo Overrider) {

Modified: cfe/trunk/lib/CodeGen/CGVtable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.h?rev=99279&r1=99278&r2=99279&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.h (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.h Tue Mar 23 10:13:06 2010
@@ -25,6 +25,67 @@
 namespace CodeGen {
   class CodeGenModule;
 
+/// ReturnAdjustment - A return adjustment.
+struct ReturnAdjustment {
+  /// NonVirtual - The non-virtual adjustment from the derived object to its
+  /// nearest virtual base.
+  int64_t NonVirtual;
+  
+  /// VBaseOffsetOffset - The offset (in bytes), relative to the address point 
+  /// of the virtual base class offset.
+  int64_t VBaseOffsetOffset;
+  
+  ReturnAdjustment() : NonVirtual(0), VBaseOffsetOffset(0) { }
+  
+  bool isEmpty() const { return !NonVirtual && !VBaseOffsetOffset; }
+
+  friend bool operator==(const ReturnAdjustment &LHS, 
+                         const ReturnAdjustment &RHS) {
+    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;
+  }
+};
+  
+/// ThisAdjustment - A 'this' pointer adjustment.
+struct ThisAdjustment {
+  /// NonVirtual - The non-virtual adjustment from the derived object to its
+  /// nearest virtual base.
+  int64_t NonVirtual;
+
+  /// VCallOffsetOffset - The offset (in bytes), relative to the address point,
+  /// of the virtual call offset.
+  int64_t VCallOffsetOffset;
+  
+  ThisAdjustment() : NonVirtual(0), VCallOffsetOffset(0) { }
+
+  bool isEmpty() const { return !NonVirtual && !VCallOffsetOffset; }
+
+  friend bool operator==(const ThisAdjustment &LHS, 
+                         const ThisAdjustment &RHS) {
+    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;
+  }
+  
+};
+
 /// ThunkAdjustment - Virtual and non-virtual adjustment for thunks.
 class ThunkAdjustment {
 public:





More information about the cfe-commits mailing list