[cfe-commits] r82210 - in /cfe/trunk/lib/Driver: ToolChains.cpp ToolChains.h Tools.cpp

Daniel Dunbar daniel at zuster.org
Fri Sep 18 01:14:46 PDT 2009


Author: ddunbar
Date: Fri Sep 18 03:14:46 2009
New Revision: 82210

URL: http://llvm.org/viewvc/llvm-project?rev=82210&view=rev
Log:
Lift getMacosxVersionMin out into Darwin ToolChain.

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

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=82210&r1=82209&r2=82210&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Sep 18 03:14:46 2009
@@ -154,6 +154,21 @@
                                        "/../../.."));
 }
 
+void Darwin::getMacosxVersionMin(const ArgList &Args,
+                                 unsigned (&Res)[3]) const {
+  if (Arg *A = Args.getLastArg(options::OPT_mmacosx_version_min_EQ)) {
+    bool HadExtra;
+    if (!Driver::GetReleaseVersion(A->getValue(Args), Res[0], Res[1], Res[2],
+                                   HadExtra) ||
+        HadExtra) {
+      const Driver &D = getHost().getDriver();
+      D.Diag(clang::diag::err_drv_invalid_version_number)
+        << A->getAsString(Args);
+    }
+  } else
+    return getMacosxVersion(Res);
+}
+
 DerivedArgList *Darwin::TranslateArgs(InputArgList &Args,
                                       const char *BoundArch) const {
   DerivedArgList *DAL = new DerivedArgList(Args, false);

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=82210&r1=82209&r2=82210&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Sep 18 03:14:46 2009
@@ -91,6 +91,10 @@
     Res[2] = DarwinVersion[1];
   }
 
+  /// getMacosxVersionMin - Get the effective -mmacosx-version-min, which is
+  /// either the -mmacosx-version-min, or the current version if unspecified.
+  void getMacosxVersionMin(const ArgList &Args, unsigned (&Res)[3]) const;
+
   const char *getMacosxVersionStr() const {
     return MacosxVersionMin.c_str();
   }

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=82210&r1=82209&r2=82210&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Sep 18 03:14:46 2009
@@ -1929,19 +1929,7 @@
   CmdArgs.push_back(Output.getFilename());
 
   unsigned MacosxVersionMin[3];
-  if (Arg *A = Args.getLastArg(options::OPT_mmacosx_version_min_EQ)) {
-    bool HadExtra;
-    if (!Driver::GetReleaseVersion(A->getValue(Args), MacosxVersionMin[0],
-                                   MacosxVersionMin[1], MacosxVersionMin[2],
-                                   HadExtra) ||
-        HadExtra) {
-      const Driver &D = getToolChain().getHost().getDriver();
-      D.Diag(clang::diag::err_drv_invalid_version_number)
-        << A->getAsString(Args);
-    }
-  } else {
-    getDarwinToolChain().getMacosxVersion(MacosxVersionMin);
-  }
+  getDarwinToolChain().getMacosxVersionMin(Args, MacosxVersionMin);
 
   if (!Args.hasArg(options::OPT_A) &&
       !Args.hasArg(options::OPT_nostdlib) &&





More information about the cfe-commits mailing list