ccc: Introduce ToolChains for mapping Actions to Tools which can
perform them.
- A ToolChain is a coherent set of tools use in a compilation
process. The idea is that a ToolChain holds roughly the information
(specs, search paths, etc.) that is in a single gcc binary.
- The default ToolChain is selected by the host and will generally
correspond to what the default system compiler would do. However,
this can be over-riden for a variety of purposes, for example the
by the driver driver or for testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62021 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/ccc/ccclib/Driver.py b/tools/ccc/ccclib/Driver.py
index 392737f..53a4c22 100644
--- a/tools/ccc/ccclib/Driver.py
+++ b/tools/ccc/ccclib/Driver.py
@@ -92,6 +92,7 @@
raise ValueError,"Invalid ccc option: %r" % cccPrintOptions
self.hostInfo = HostInfo.getHostInfo(self)
+ self.toolChain = self.hostInfo.getToolChain()
args = self.parser.parseArgs(argv)
@@ -550,15 +551,6 @@
if hasNoIntegratedCPP:
self.claim(hasNoIntegratedCPP)
- toolMap = {
- Phases.PreprocessPhase : Tools.GCC_PreprocessTool(),
- Phases.CompilePhase : Tools.GCC_CompileTool(),
- Phases.PrecompilePhase : Tools.GCC_PrecompileTool(),
- Phases.AssemblePhase : Tools.DarwinAssemblerTool(),
- Phases.LinkPhase : Tools.Collect2Tool(),
- Phases.LipoPhase : Tools.LipoTool(),
- }
-
class InputInfo:
def __init__(self, source, type, baseInput):
self.source = source
@@ -596,7 +588,7 @@
canAcceptPipe, atTopLevel, phase.arch)
assert isinstance(phase, Phases.JobAction)
- tool = toolMap[phase.phase.__class__]
+ tool = self.toolChain.selectTool(phase)
# See if we should use an integrated CPP. We only use an
# integrated cpp when we have exactly one input, since this is