[MachO] Move trivial accessors to header.
[oota-llvm.git] / include / llvm / Object / MachO.h
index 903398321a93fffccbf58bd92eb10fccd48d14dc..75259bc48f81fd69d7bcf6cbfe8e10c6749f98df 100644 (file)
@@ -344,12 +344,6 @@ public:
   getLinkerOptionLoadCommand(const LoadCommandInfo &L) const;
   MachO::version_min_command
   getVersionMinLoadCommand(const LoadCommandInfo &L) const;
   getLinkerOptionLoadCommand(const LoadCommandInfo &L) const;
   MachO::version_min_command
   getVersionMinLoadCommand(const LoadCommandInfo &L) const;
-  static uint32_t
-  getVersionMinMajor(MachO::version_min_command &C, bool SDK);
-  static uint32_t
-  getVersionMinMinor(MachO::version_min_command &C, bool SDK);
-  static uint32_t
-  getVersionMinUpdate(MachO::version_min_command &C, bool SDK);
   MachO::dylib_command
   getDylibIDLoadCommand(const LoadCommandInfo &L) const;
   MachO::dyld_info_command
   MachO::dylib_command
   getDylibIDLoadCommand(const LoadCommandInfo &L) const;
   MachO::dyld_info_command
@@ -428,6 +422,24 @@ public:
     return v->isMachO();
   }
 
     return v->isMachO();
   }
 
+  static uint32_t
+  getVersionMinMajor(MachO::version_min_command &C, bool SDK) {
+    uint32_t VersionOrSDK = (SDK) ? C.sdk : C.version;
+    return (VersionOrSDK >> 16) & 0xffff;
+  }
+
+  static uint32_t
+  getVersionMinMinor(MachO::version_min_command &C, bool SDK) {
+    uint32_t VersionOrSDK = (SDK) ? C.sdk : C.version;
+    return (VersionOrSDK >> 8) & 0xff;
+  }
+
+  static uint32_t
+  getVersionMinUpdate(MachO::version_min_command &C, bool SDK) {
+    uint32_t VersionOrSDK = (SDK) ? C.sdk : C.version;
+    return VersionOrSDK & 0xff;
+  }
+
 private:
   uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;
 
 private:
   uint64_t getSymbolValueImpl(DataRefImpl Symb) const override;