ccc: Recognize -emit-llvm [-S].
 - Unlike llvm-gcc, this doesn't yet treat -emit-llvm output as a
   linker input.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63014 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/ccc/ccclib/ToolChain.py b/tools/ccc/ccclib/ToolChain.py
index d0c1fe1..564b617 100644
--- a/tools/ccc/ccclib/ToolChain.py
+++ b/tools/ccc/ccclib/ToolChain.py
@@ -64,12 +64,14 @@
         self.archName = archName
 
         self.clangTool = Tools.Clang_CompileTool(self)
+        cc = Tools.Darwin_X86_CompileTool(self)
         self.toolMap = {
             Phases.PreprocessPhase : Tools.Darwin_X86_PreprocessTool(self),
             Phases.AnalyzePhase : self.clangTool,
-            Phases.SyntaxOnlyPhase : Tools.Darwin_X86_CompileTool(self),
-            Phases.CompilePhase : Tools.Darwin_X86_CompileTool(self),
-            Phases.PrecompilePhase : Tools.Darwin_X86_CompileTool(self),
+            Phases.SyntaxOnlyPhase : cc,
+            Phases.EmitLLVMPhase : cc,
+            Phases.CompilePhase : cc,
+            Phases.PrecompilePhase : cc,
             Phases.AssemblePhase : Tools.Darwin_AssembleTool(self),
             Phases.LinkPhase : Tools.Darwin_X86_LinkTool(self),
             Phases.LipoPhase : Tools.LipoTool(),
@@ -110,7 +112,9 @@
         if self.driver.cccClang and self.archName == 'i386':
             if (action.inputs[0].type in (Types.CType, Types.CTypeNoPP,
                                           Types.ObjCType, Types.ObjCTypeNoPP) and
-                isinstance(action.phase, Phases.CompilePhase)):
+                (isinstance(action.phase, Phases.CompilePhase) or
+                 isinstance(action.phase, Phases.SyntaxOnlyPhase) or
+                 isinstance(action.phase, Phases.EmitLLVMPhase))):
                 return self.clangTool
             elif (action.inputs[0].type in (Types.CHeaderType, Types.CHeaderNoPPType,
                                             Types.ObjCHeaderType, Types.ObjCHeaderNoPPType) and
@@ -200,11 +204,13 @@
 
     def __init__(self, driver):
         super(Generic_GCC_ToolChain, self).__init__(driver)
+        cc = Tools.GCC_CompileTool()
         self.toolMap = {
             Phases.PreprocessPhase : Tools.GCC_PreprocessTool(),
             Phases.AnalyzePhase : Tools.Clang_CompileTool(self),
-            Phases.SyntaxOnlyPhase : Tools.GCC_CompileTool(),
-            Phases.CompilePhase : Tools.GCC_CompileTool(),
+            Phases.SyntaxOnlyPhase : cc,
+            Phases.EmitLLVMPhase : cc,
+            Phases.CompilePhase : cc,
             Phases.PrecompilePhase : Tools.GCC_PrecompileTool(),
             Phases.AssemblePhase : Tools.GCC_AssembleTool(),
             Phases.LinkPhase : Tools.GCC_LinkTool(),