Driver: Add darwin::Link tool.
 - <rdar://problem/6717381> [driver] implement ld argument translation
   in new driver


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67760 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h
index 672096e..2b06a3d 100644
--- a/lib/Driver/Tools.h
+++ b/lib/Driver/Tools.h
@@ -17,6 +17,10 @@
 
 namespace clang {
 namespace driver {
+namespace toolchains {
+  class Darwin_X86;
+}
+
 namespace tools {
 
   class VISIBILITY_HIDDEN Clang : public Tool {
@@ -127,6 +131,34 @@
                               const char *LinkingOutput) const;
   };
 
+  class VISIBILITY_HIDDEN Link : public Tool  {
+    void AddDarwinArch(const ArgList &Args, ArgStringList &CmdArgs) const;
+    void AddDarwinSubArch(const ArgList &Args, ArgStringList &CmdArgs) const;
+    void AddLinkArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
+
+    /// The default macosx-version-min.
+    const char *MacosxVersionMin;
+
+    const toolchains::Darwin_X86 &getDarwinToolChain() const;
+
+  public:
+    Link(const ToolChain &TC,
+         const char *_MacosxVersionMin) 
+      : Tool("darwin::Link", TC), MacosxVersionMin(_MacosxVersionMin) {
+    }
+
+    virtual bool acceptsPipedInput() const { return false; }
+    virtual bool canPipeOutput() const { return false; }
+    virtual bool hasIntegratedCPP() const { return false; }
+
+    virtual void ConstructJob(Compilation &C, const JobAction &JA,
+                              Job &Dest,
+                              const InputInfo &Output, 
+                              const InputInfoList &Inputs, 
+                              const ArgList &TCArgs, 
+                              const char *LinkingOutput) const;
+  };
+
   class VISIBILITY_HIDDEN Lipo : public Tool  {
   public:
     Lipo(const ToolChain &TC) : Tool("darwin::Lipo", TC) {}