DragonFly ToolChain definition for driver.
 - Patch by Alex Hornung!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70635 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index 87927f8..7310535 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -31,8 +31,7 @@
                        const char *Platform, const char *OS, 
                        const unsigned (&_DarwinVersion)[3],
                        const unsigned (&_GCCVersion)[3])
-  : ToolChain(Host, Arch, Platform, OS) 
-{
+  : ToolChain(Host, Arch, Platform, OS) {
   DarwinVersion[0] = _DarwinVersion[0];
   DarwinVersion[1] = _DarwinVersion[1];
   DarwinVersion[2] = _DarwinVersion[2];
@@ -422,3 +421,43 @@
 
   return *T;
 }
+
+/// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
+
+DragonFly::DragonFly(const HostInfo &Host, const char *Arch, 
+                 const char *Platform, const char *OS)
+  : Generic_GCC(Host, Arch, Platform, OS) {
+
+  // Path mangling to find libexec
+  std::string Path(getHost().getDriver().Dir);
+
+  Path += "/../libexec";
+  getProgramPaths().push_back(Path);
+  getProgramPaths().push_back(getHost().getDriver().Dir);  
+
+  getFilePaths().push_back(getHost().getDriver().Dir + "/../lib");
+  getFilePaths().push_back("/usr/lib");
+  getFilePaths().push_back("/usr/lib/gcc41");
+}
+
+Tool &DragonFly::SelectTool(const Compilation &C, const JobAction &JA) const {
+  Action::ActionClass Key;
+  if (getHost().getDriver().ShouldUseClangCompiler(C, JA, getArchName()))
+    Key = Action::AnalyzeJobClass;
+  else
+    Key = JA.getKind();
+
+  Tool *&T = Tools[Key];
+  if (!T) {
+    switch (Key) {
+    case Action::AssembleJobClass:
+      T = new tools::dragonfly::Assemble(*this); break;
+    case Action::LinkJobClass:
+      T = new tools::dragonfly::Link(*this); break;
+    default:
+      T = &Generic_GCC::SelectTool(C, JA);
+    }
+  }
+
+  return *T;
+}