]> granicus.if.org Git - clang/commitdiff
Move ReturnAdjustment and ThisAdjustment out into CGVtable.h
authorAnders Carlsson <andersca@mac.com>
Tue, 23 Mar 2010 15:13:06 +0000 (15:13 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 23 Mar 2010 15:13:06 +0000 (15:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99279 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGVtable.cpp
lib/CodeGen/CGVtable.h

index 83eccc8aa83963213d121c48811511f579582c07..b34e72953373cd2a734a139ccece3a5658ba260d 100644 (file)
@@ -1135,36 +1135,6 @@ private:
   /// 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 @@ private:
   /// 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 @@ void VtableBuilder::ComputeThisAdjustments() {
   }
 }
 
-VtableBuilder::ReturnAdjustment 
-VtableBuilder::ComputeReturnAdjustment(BaseOffset Offset) {
+ReturnAdjustment VtableBuilder::ComputeReturnAdjustment(BaseOffset Offset) {
   ReturnAdjustment Adjustment;
   
   if (!Offset.isEmpty()) {
@@ -1570,7 +1508,7 @@ VtableBuilder::ComputeThisAdjustmentBaseOffset(BaseSubobject Base,
   return BaseOffset();
 }
   
-VtableBuilder::ThisAdjustment 
+ThisAdjustment 
 VtableBuilder::ComputeThisAdjustment(const CXXMethodDecl *MD, 
                                      uint64_t BaseOffsetInLayoutClass,
                                      FinalOverriders::OverriderInfo Overrider) {
index ba5a4295d3898a80ca18c729ced2f3cd3dfc0180..77687488be4a616456e210f3d24892b0798dd984 100644 (file)
@@ -25,6 +25,67 @@ namespace clang {
 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: