[lld] 4f688d0 - [lld-macho] Change constant std::vector to std::array (NFC)

Daniel Bertalan via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 4 13:58:34 PDT 2022


Author: Daniel Bertalan
Date: 2022-09-04T22:43:02+02:00
New Revision: 4f688d00f43056a94869aff32d5cdcddedf88a84

URL: https://github.com/llvm/llvm-project/commit/4f688d00f43056a94869aff32d5cdcddedf88a84
DIFF: https://github.com/llvm/llvm-project/commit/4f688d00f43056a94869aff32d5cdcddedf88a84.diff

LOG: [lld-macho] Change constant std::vector to std::array (NFC)

Added: 
    

Modified: 
    lld/MachO/Driver.cpp
    lld/MachO/Writer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index d22c3ea718c4..533273e73bb9 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -925,12 +925,12 @@ PlatformType macho::removeSimulator(PlatformType platform) {
 }
 
 static bool dataConstDefault(const InputArgList &args) {
-  static const std::vector<std::pair<PlatformType, VersionTuple>> minVersion = {
-      {PLATFORM_MACOS, VersionTuple(10, 15)},
-      {PLATFORM_IOS, VersionTuple(13, 0)},
-      {PLATFORM_TVOS, VersionTuple(13, 0)},
-      {PLATFORM_WATCHOS, VersionTuple(6, 0)},
-      {PLATFORM_BRIDGEOS, VersionTuple(4, 0)}};
+  static const std::array<std::pair<PlatformType, VersionTuple>, 5> minVersion =
+      {{{PLATFORM_MACOS, VersionTuple(10, 15)},
+        {PLATFORM_IOS, VersionTuple(13, 0)},
+        {PLATFORM_TVOS, VersionTuple(13, 0)},
+        {PLATFORM_WATCHOS, VersionTuple(6, 0)},
+        {PLATFORM_BRIDGEOS, VersionTuple(4, 0)}}};
   PlatformType platform = removeSimulator(config->platformInfo.target.Platform);
   auto it = llvm::find_if(minVersion,
                           [&](const auto &p) { return p.first == platform; });

diff  --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 89b14e15b399..0df38498d0a2 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -680,14 +680,14 @@ void Writer::scanSymbols() {
 
 // TODO: ld64 enforces the old load commands in a few other cases.
 static bool useLCBuildVersion(const PlatformInfo &platformInfo) {
-  static const std::vector<std::pair<PlatformType, VersionTuple>> minVersion = {
-      {PLATFORM_MACOS, VersionTuple(10, 14)},
-      {PLATFORM_IOS, VersionTuple(12, 0)},
-      {PLATFORM_IOSSIMULATOR, VersionTuple(13, 0)},
-      {PLATFORM_TVOS, VersionTuple(12, 0)},
-      {PLATFORM_TVOSSIMULATOR, VersionTuple(13, 0)},
-      {PLATFORM_WATCHOS, VersionTuple(5, 0)},
-      {PLATFORM_WATCHOSSIMULATOR, VersionTuple(6, 0)}};
+  static const std::array<std::pair<PlatformType, VersionTuple>, 7> minVersion =
+      {{{PLATFORM_MACOS, VersionTuple(10, 14)},
+        {PLATFORM_IOS, VersionTuple(12, 0)},
+        {PLATFORM_IOSSIMULATOR, VersionTuple(13, 0)},
+        {PLATFORM_TVOS, VersionTuple(12, 0)},
+        {PLATFORM_TVOSSIMULATOR, VersionTuple(13, 0)},
+        {PLATFORM_WATCHOS, VersionTuple(5, 0)},
+        {PLATFORM_WATCHOSSIMULATOR, VersionTuple(6, 0)}}};
   auto it = llvm::find_if(minVersion, [&](const auto &p) {
     return p.first == platformInfo.target.Platform;
   });


        


More information about the llvm-commits mailing list