diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-03-18 17:52:57 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-03-18 17:52:57 +0000 |
commit | 5470cd27e47aea163daaa76dde36010753400663 (patch) | |
tree | dca2d75092c535f52f062f548aefc18d9dc784ed /lib/Driver/ToolChains.cpp | |
parent | e5dce308870cd7d6b5156640af3724433bc1c575 (diff) |
Refactor a bit of duplicated code to useIntegratedAs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains.cpp')
-rw-r--r-- | lib/Driver/ToolChains.cpp | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index c8038d1888..5b8f5c9806 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -184,10 +184,6 @@ Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA) const { Key = Action::AnalyzeJobClass; } - bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as, - options::OPT_no_integrated_as, - IsIntegratedAssemblerDefault()); - Tool *&T = Tools[Key]; if (!T) { switch (Key) { @@ -201,7 +197,7 @@ Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA) const { case Action::CompileJobClass: T = new tools::Clang(*this); break; case Action::AssembleJobClass: { - if (UseIntegratedAs) + if (useIntegratedAs(C.getArgs())) T = new tools::ClangAs(*this); else T = new tools::darwin::Assemble(*this); @@ -1733,15 +1729,11 @@ Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA) const { else Key = JA.getKind(); - bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as, - options::OPT_no_integrated_as, - IsIntegratedAssemblerDefault()); - Tool *&T = Tools[Key]; if (!T) { switch (Key) { case Action::AssembleJobClass: { - if (UseIntegratedAs) + if (useIntegratedAs(C.getArgs())) T = new tools::ClangAs(*this); else T = new tools::openbsd::Assemble(*this); @@ -1772,15 +1764,11 @@ Tool &Bitrig::SelectTool(const Compilation &C, const JobAction &JA) const { else Key = JA.getKind(); - bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as, - options::OPT_no_integrated_as, - IsIntegratedAssemblerDefault()); - Tool *&T = Tools[Key]; if (!T) { switch (Key) { case Action::AssembleJobClass: { - if (UseIntegratedAs) + if (useIntegratedAs(C.getArgs())) T = new tools::ClangAs(*this); else T = new tools::bitrig::Assemble(*this); @@ -1863,15 +1851,11 @@ Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA) const { else Key = JA.getKind(); - bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as, - options::OPT_no_integrated_as, - IsIntegratedAssemblerDefault()); - Tool *&T = Tools[Key]; if (!T) { switch (Key) { case Action::AssembleJobClass: - if (UseIntegratedAs) + if (useIntegratedAs(C.getArgs())) T = new tools::ClangAs(*this); else T = new tools::freebsd::Assemble(*this); @@ -1924,15 +1908,11 @@ Tool &NetBSD::SelectTool(const Compilation &C, const JobAction &JA) const { else Key = JA.getKind(); - bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as, - options::OPT_no_integrated_as, - IsIntegratedAssemblerDefault()); - Tool *&T = Tools[Key]; if (!T) { switch (Key) { case Action::AssembleJobClass: - if (UseIntegratedAs) + if (useIntegratedAs(C.getArgs())) T = new tools::ClangAs(*this); else T = new tools::netbsd::Assemble(*this); @@ -2427,15 +2407,11 @@ Tool &Linux::SelectTool(const Compilation &C, const JobAction &JA) const { else Key = JA.getKind(); - bool UseIntegratedAs = C.getArgs().hasFlag(options::OPT_integrated_as, - options::OPT_no_integrated_as, - IsIntegratedAssemblerDefault()); - Tool *&T = Tools[Key]; if (!T) { switch (Key) { case Action::AssembleJobClass: - if (UseIntegratedAs) + if (useIntegratedAs(C.getArgs())) T = new tools::ClangAs(*this); else T = new tools::linuxtools::Assemble(*this); |