aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/ToolChain.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-03-19 00:36:57 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-03-19 00:36:57 +0000
commitc0a55d12caff98504eace18b553bb111160a8131 (patch)
tree31215894100535e05b891263716ba5102df6c442 /lib/Driver/ToolChain.cpp
parent677e15ffee2ecc9c1c8f46fd77cab4b5afb59640 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177368 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChain.cpp')
-rw-r--r--lib/Driver/ToolChain.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index 5322a6dae2..def3b3ddea 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -63,6 +63,26 @@ bool ToolChain::IsUnwindTablesDefault() const {
return false;
}
+Tool *ToolChain::constructTool(Action::ActionClass AC) const {
+ switch (AC) {
+ case Action::InputClass:
+ case Action::BindArchClass:
+ case Action::AssembleJobClass:
+ case Action::LinkJobClass:
+ case Action::LipoJobClass:
+ case Action::DsymutilJobClass:
+ case Action::VerifyJobClass:
+ llvm_unreachable("Invalid tool kind.");
+
+ case Action::CompileJobClass:
+ case Action::PrecompileJobClass:
+ case Action::PreprocessJobClass:
+ case Action::AnalyzeJobClass:
+ case Action::MigrateJobClass:
+ return new tools::Clang(*this);
+ }
+}
+
Tool &ToolChain::SelectTool(const JobAction &JA) const {
Action::ActionClass Key;
if (getDriver().ShouldUseClangCompiler(JA))