ccc: Add dummy Clang/Compile tool and use on Darwin/X86 for C files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62204 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/ccc/ccclib/ToolChain.py b/tools/ccc/ccclib/ToolChain.py
index 1cb55fa..13dc114 100644
--- a/tools/ccc/ccclib/ToolChain.py
+++ b/tools/ccc/ccclib/ToolChain.py
@@ -1,6 +1,7 @@
import Arguments
import Phases
import Tools
+import Types
###
@@ -42,12 +43,13 @@
return args
class Darwin_X86_ToolChain(ToolChain):
- def __init__(self, driver, darwinVersion, gccVersion):
+ def __init__(self, driver, darwinVersion, gccVersion, archName):
super(Darwin_X86_ToolChain, self).__init__(driver)
assert isinstance(darwinVersion, tuple) and len(darwinVersion) == 3
assert isinstance(gccVersion, tuple) and len(gccVersion) == 3
self.darwinVersion = darwinVersion
self.gccVersion = gccVersion
+ self.archName = archName
self.toolMap = {
Phases.PreprocessPhase : Tools.GCC_PreprocessTool(),
@@ -57,6 +59,7 @@
Phases.LinkPhase : Tools.Darwin_X86_LinkTool(self),
Phases.LipoPhase : Tools.LipoTool(),
}
+ self.clangTool = Tools.Clang_CompileTool()
def getToolChainDir(self):
return 'i686-apple-darwin%d/%s' % (self.darwinVersion[0],
@@ -72,6 +75,13 @@
def selectTool(self, action):
assert isinstance(action, Phases.JobAction)
+
+ if (self.driver.cccClang and
+ self.archName == 'i386' and
+ action.inputs[0].type in (Types.CType, Types.CTypeNoPP) and
+ isinstance(action.phase, Phases.CompilePhase)):
+ return self.clangTool
+
return self.toolMap[action.phase.__class__]
def translateArgs(self, args, arch):