Split Darwin toolchain into Clang and GCC Darwin toolchains with a common base.

llvm-svn: 82213
diff --git a/clang/lib/Driver/ToolChains.h b/clang/lib/Driver/ToolChains.h
index 91e5750..6088d961 100644
--- a/clang/lib/Driver/ToolChains.h
+++ b/clang/lib/Driver/ToolChains.h
@@ -22,9 +22,9 @@
 namespace driver {
 namespace toolchains {
 
-  /// Generic_GCC - A tool chain using the 'gcc' command to perform
-  /// all subcommands; this relies on gcc translating the majority of
-  /// command line options.
+/// Generic_GCC - A tool chain using the 'gcc' command to perform
+/// all subcommands; this relies on gcc translating the majority of
+/// command line options.
 class VISIBILITY_HIDDEN Generic_GCC : public ToolChain {
 protected:
   mutable llvm::DenseMap<unsigned, Tool*> Tools;
@@ -44,21 +44,18 @@
   virtual const char *GetForcedPicModel() const;
 };
 
-/// Darwin - Darwin tool chain.
+/// Darwin - The base Darwin tool chain.
 class VISIBILITY_HIDDEN Darwin : public ToolChain {
   mutable llvm::DenseMap<unsigned, Tool*> Tools;
 
   /// Darwin version of tool chain.
   unsigned DarwinVersion[3];
 
-  /// GCC version to use.
-  unsigned GCCVersion[3];
-
-  /// Whether this is this an iPhone toolchain.
-  bool IsIPhone;
-
-  /// The directory suffix for this tool chain.
-  std::string ToolChainDir;
+  /// Whether this is this an iPhoneOS toolchain.
+  //
+  // FIXME: This should go away, such differences should be completely
+  // determined by the target triple.
+  bool IsIPhoneOS;
 
   /// The default macosx-version-min of this tool chain; empty until
   /// initialized.
@@ -71,9 +68,7 @@
 
 public:
   Darwin(const HostInfo &Host, const llvm::Triple& Triple,
-         const unsigned (&DarwinVersion)[3],
-         const unsigned (&GCCVersion)[3],
-         bool IsIPhone);
+         const unsigned (&DarwinVersion)[3], bool IsIPhoneOS);
   ~Darwin();
 
   /// @name Darwin Specific Toolchain API
@@ -122,13 +117,15 @@
   /// \param Args - The input argument list.
   /// \param CmdArgs [out] - The command argument list to append the paths
   /// (prefixed by -L) to.
-  void AddLinkSearchPathArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
+  virtual void AddLinkSearchPathArgs(const ArgList &Args,
+                                     ArgStringList &CmdArgs) const = 0;
 
   /// AddLinkRuntimeLibArgs - Add the linker arguments to link the compiler
   /// runtime library.
-  void AddLinkRuntimeLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
+  virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
+                                     ArgStringList &CmdArgs) const = 0;
 
-  bool isIPhone() const { return IsIPhone; }
+  bool isIPhoneOS() const { return IsIPhoneOS; }
 
   /// }
   /// @name ToolChain Implementation
@@ -147,10 +144,53 @@
   /// }
 };
 
-  /// Darwin_GCC - Generic Darwin tool chain using gcc.
-class VISIBILITY_HIDDEN Darwin_GCC : public Generic_GCC {
+/// DarwinClang - The Darwin toolchain used by Clang.
+class VISIBILITY_HIDDEN DarwinClang : public Darwin {
 public:
-  Darwin_GCC(const HostInfo &Host, const llvm::Triple& Triple)
+  DarwinClang(const HostInfo &Host, const llvm::Triple& Triple,
+              const unsigned (&DarwinVersion)[3], bool IsIPhoneOS);
+
+  /// @name Darwin ToolChain Implementation
+  /// {
+
+  virtual void AddLinkSearchPathArgs(const ArgList &Args,
+                                    ArgStringList &CmdArgs) const;
+
+  virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
+                                     ArgStringList &CmdArgs) const;
+
+  /// }
+};
+
+/// DarwinGCC - The Darwin toolchain used by GCC.
+class VISIBILITY_HIDDEN DarwinGCC : public Darwin {
+  /// GCC version to use.
+  unsigned GCCVersion[3];
+
+  /// The directory suffix for this tool chain.
+  std::string ToolChainDir;
+
+public:
+  DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple,
+            const unsigned (&DarwinVersion)[3], const unsigned (&GCCVersion)[3],
+            bool IsIPhoneOS);
+
+  /// @name Darwin ToolChain Implementation
+  /// {
+
+  virtual void AddLinkSearchPathArgs(const ArgList &Args,
+                                    ArgStringList &CmdArgs) const;
+
+  virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
+                                     ArgStringList &CmdArgs) const;
+
+  /// }
+};
+
+/// Darwin_Generic_GCC - Generic Darwin tool chain using gcc.
+class VISIBILITY_HIDDEN Darwin_Generic_GCC : public Generic_GCC {
+public:
+  Darwin_Generic_GCC(const HostInfo &Host, const llvm::Triple& Triple)
     : Generic_GCC(Host, Triple) {}
 
   virtual const char *GetDefaultRelocationModel() const { return "pic"; }