r239980 - [Driver] Simplify code choosing between MacOS and iOS platforms. NFC.

Alexey Samsonov vonosmas at gmail.com
Wed Jun 17 17:36:38 PDT 2015


Author: samsonov
Date: Wed Jun 17 19:36:38 2015
New Revision: 239980

URL: http://llvm.org/viewvc/llvm-project?rev=239980&view=rev
Log:
[Driver] Simplify code choosing between MacOS and iOS platforms. NFC.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=239980&r1=239979&r2=239980&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Jun 17 19:36:38 2015
@@ -515,13 +515,17 @@ void Darwin::AddDeploymentTarget(Derived
       }
     }
 
-    // If no OSX or iOS target has been specified and we're compiling for armv7,
-    // go ahead as assume we're targeting iOS.
-    StringRef MachOArchName = getMachOArchName(Args);
-    if (OSXTarget.empty() && iOSTarget.empty() &&
-        (MachOArchName == "armv7" || MachOArchName == "armv7s" ||
-         MachOArchName == "arm64"))
+    // If no OSX or iOS target has been specified, try to guess platform
+    // from arch name.
+    if (OSXTarget.empty() && iOSTarget.empty()) {
+      StringRef MachOArchName = getMachOArchName(Args);
+      if (MachOArchName == "armv7" || MachOArchName == "armv7s" ||
+          MachOArchName == "arm64")
         iOSTarget = iOSVersionMin;
+      else if (MachOArchName != "armv6m" && MachOArchName != "armv7m" &&
+               MachOArchName != "armv7em")
+        OSXTarget = MacosxVersionMin;
+    }
 
     // Allow conflicts among OSX and iOS for historical reasons, but choose the
     // default platform.
@@ -542,12 +546,6 @@ void Darwin::AddDeploymentTarget(Derived
       const Option O = Opts.getOption(options::OPT_miphoneos_version_min_EQ);
       iOSVersion = Args.MakeJoinedArg(nullptr, O, iOSTarget);
       Args.append(iOSVersion);
-    } else if (MachOArchName != "armv6m" && MachOArchName != "armv7m" &&
-               MachOArchName != "armv7em") {
-      // Otherwise, assume we are targeting OS X.
-      const Option O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);
-      OSXVersion = Args.MakeJoinedArg(nullptr, O, MacosxVersionMin);
-      Args.append(OSXVersion);
     }
   }
 





More information about the cfe-commits mailing list