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/Tools.py b/tools/ccc/ccclib/Tools.py
index 8b3ee74..0dcd52e 100644
--- a/tools/ccc/ccclib/Tools.py
+++ b/tools/ccc/ccclib/Tools.py
@@ -179,9 +179,15 @@
         patchOutputNameForPTH = False
 
         if isinstance(phase.phase, Phases.AnalyzePhase):
+            assert outputType is Types.PlistType
             cmd_args.append('-analyze')
         elif isinstance(phase.phase, Phases.SyntaxOnlyPhase):
+            assert outputType is Types.NothingType
             cmd_args.append('-fsyntax-only')
+        elif outputType is Types.LLVMAsmType:
+            cmd_args.append('-emit-llvm')
+        elif outputType is Types.LLVMBCType:
+            cmd_args.append('-emit-llvm-bc')
         elif outputType is Types.AsmTypeNoPP:
             cmd_args.append('-S')
         elif outputType is Types.PCHType:
@@ -688,6 +694,15 @@
             raise Arguments.InvalidArgumentsError("-traditional is not supported without -E")
 
         if outputType is Types.PCHType:
+            pass
+        elif outputType is Types.AsmTypeNoPP:
+            pass
+        elif outputType is Types.LLVMAsmType:
+            cmd_args.append('-emit-llvm')
+        elif outputType is Types.LLVMBCType:
+            cmd_args.append('-emit-llvm-bc')
+
+        if outputType is Types.PCHType:
             output_args = []
         else:
             output_args = self.getOutputArgs(arglist, output)