Finish refactoring the tool selection logic.

The general pattern now is that Foobar::constructTool only creates tools
defined in the tools::foobar namespace and then delegates to the parent.

The remaining duplicated code is now in the tools themselves.

llvm-svn: 177368
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 802d0ce..0e29ba0 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -174,15 +174,6 @@
 
 Tool *Darwin::constructTool(Action::ActionClass AC) const {
   switch (AC) {
-  case Action::InputClass:
-  case Action::BindArchClass:
-    llvm_unreachable("Invalid tool kind.");
-  case Action::PreprocessJobClass:
-  case Action::AnalyzeJobClass:
-  case Action::MigrateJobClass:
-  case Action::PrecompileJobClass:
-  case Action::CompileJobClass:
-    return new tools::Clang(*this);
   case Action::AssembleJobClass:
     return new tools::darwin::Assemble(*this);
   case Action::LinkJobClass:
@@ -193,6 +184,8 @@
     return new tools::darwin::Dsymutil(*this);
   case Action::VerifyJobClass:
     return new tools::darwin::VerifyDebug(*this);
+  default:
+    return ToolChain::constructTool(AC);
   }
 }
 
@@ -1359,31 +1352,18 @@
 
 Tool *Generic_GCC::constructTool(Action::ActionClass AC) const {
   switch (AC) {
-  case Action::InputClass:
-  case Action::BindArchClass:
-    llvm_unreachable("Invalid tool kind.");
   case Action::PreprocessJobClass:
     return new tools::gcc::Preprocess(*this);
   case Action::PrecompileJobClass:
     return new tools::gcc::Precompile(*this);
-  case Action::AnalyzeJobClass:
-  case Action::MigrateJobClass:
-    return new tools::Clang(*this);
   case Action::CompileJobClass:
     return new tools::gcc::Compile(*this);
   case Action::AssembleJobClass:
     return new tools::gcc::Assemble(*this);
   case Action::LinkJobClass:
     return new tools::gcc::Link(*this);
-
-    // This is a bit ungeneric, but the only platform using a driver
-    // driver is Darwin.
-  case Action::LipoJobClass:
-    return new tools::darwin::Lipo(*this);
-  case Action::DsymutilJobClass:
-    return new tools::darwin::Dsymutil(*this);
-  case Action::VerifyJobClass:
-    return new tools::darwin::VerifyDebug(*this);
+  default:
+    return ToolChain::constructTool(AC);
   }
 }
 
@@ -1518,7 +1498,6 @@
   case Action::LinkJobClass:
     return new tools::hexagon::Link(*this);
   default:
-    assert(false && "Unsupported action for Hexagon target.");
     return Linux::constructTool(AC);
   }
 }
@@ -1637,17 +1616,6 @@
   return false;
 }
 
-Tool *TCEToolChain::constructTool(Action::ActionClass AC) const {
-  switch (AC) {
-  case Action::PreprocessJobClass:
-    return new tools::gcc::Preprocess(*this);
-  case Action::AnalyzeJobClass:
-    return new tools::Clang(*this);
-  default:
-    llvm_unreachable("Unsupported action for TCE target.");
-  }
-}
-
 /// OpenBSD - OpenBSD tool chain which can call as(1) and ld(1) directly.
 
 OpenBSD::OpenBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)