diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-01-20 05:51:52 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-01-20 05:51:52 +0000 |
| commit | 79660913998c5e7a46a0e6f7b2d7571c6fe9038d (patch) | |
| tree | 3227bf2131240fb2d4f8af008a653dc11a2edf11 /clang/tools/ccc/ccclib | |
| parent | 8bc09f4085d68d4597d096c07e76ae34ad9045c1 (diff) | |
| download | bcm5719-llvm-79660913998c5e7a46a0e6f7b2d7571c6fe9038d.tar.gz bcm5719-llvm-79660913998c5e7a46a0e6f7b2d7571c6fe9038d.zip | |
ccc: Darwin/x86: Teach compile tool how to build .pch files. xcc is
now fully independent of the gcc driver when targetting Darwin/x86.
llvm-svn: 62570
Diffstat (limited to 'clang/tools/ccc/ccclib')
| -rw-r--r-- | clang/tools/ccc/ccclib/ToolChain.py | 2 | ||||
| -rw-r--r-- | clang/tools/ccc/ccclib/Tools.py | 32 |
2 files changed, 24 insertions, 10 deletions
diff --git a/clang/tools/ccc/ccclib/ToolChain.py b/clang/tools/ccc/ccclib/ToolChain.py index c3e585efb04..ac1cc0a0bad 100644 --- a/clang/tools/ccc/ccclib/ToolChain.py +++ b/clang/tools/ccc/ccclib/ToolChain.py @@ -54,7 +54,7 @@ class Darwin_X86_ToolChain(ToolChain): self.toolMap = { Phases.PreprocessPhase : Tools.Darwin_X86_PreprocessTool(self), Phases.CompilePhase : Tools.Darwin_X86_CompileTool(self), - Phases.PrecompilePhase : Tools.GCC_PrecompileTool(), + Phases.PrecompilePhase : Tools.Darwin_X86_CompileTool(self), Phases.AssemblePhase : Tools.Darwin_AssembleTool(self), Phases.LinkPhase : Tools.Darwin_X86_LinkTool(self), Phases.LipoPhase : Tools.LipoTool(), diff --git a/clang/tools/ccc/ccclib/Tools.py b/clang/tools/ccc/ccclib/Tools.py index ab9ad7b5a86..06d1ab14087 100644 --- a/clang/tools/ccc/ccclib/Tools.py +++ b/clang/tools/ccc/ccclib/Tools.py @@ -280,21 +280,21 @@ class Darwin_X86_CC1Tool(Tool): """getCC1Name(type) -> name, use-cpp, is-cxx""" # FIXME: Get bool results from elsewhere. - if type is Types.CType: + if type is Types.CType or type is Types.CHeaderType: return 'cc1',True,False - elif type is Types.CTypeNoPP: + elif type is Types.CTypeNoPP or type is Types.CHeaderNoPPType: return 'cc1',False,False - elif type is Types.ObjCType: + elif type is Types.ObjCType or type is Types.ObjCHeaderType: return 'cc1obj',True,False - elif type is Types.ObjCTypeNoPP: + elif type is Types.ObjCTypeNoPP or type is Types.ObjCHeaderNoPPTypeP: return 'cc1obj',True,False - elif type is Types.CXXType: + elif type is Types.CXXType or type is Types.CXXHeaderType: return 'cc1plus',True,True - elif type is Types.CXXTypeNoPP: + elif type is Types.CXXTypeNoPP or type is Types.CXXHeaderNoPPType: return 'cc1plus',False,True - elif type is Types.ObjCXXType: + elif type is Types.ObjCXXType or type is Types.ObjCXXHeaderType: return 'cc1objplus',True,True - elif type is Types.ObjCXXTypeNoPP: + elif type is Types.ObjCXXTypeNoPP or type is Types.ObjCXXHeaderNoPPType: return 'cc1objplus',False,True else: raise ValueError,"Unexpected type for Darwin compile tool." @@ -622,7 +622,10 @@ class Darwin_X86_CompileTool(Darwin_X86_CC1Tool): arglist.getLastArg(arglist.parser.f_traditionalOption)): raise Arguments.InvalidArgumentsError("-traditional is not supported without -E") - output_args = self.getOutputArgs(arglist, output) + if outputType is Types.PCHType: + output_args = [] + else: + output_args = self.getOutputArgs(arglist, output) # There is no need for this level of compatibility, but it # makes diffing easier. @@ -653,6 +656,17 @@ class Darwin_X86_CompileTool(Darwin_X86_CC1Tool): early_output_args, isCXX) cmd_args.extend(end_output_args) + if outputType is Types.PCHType: + assert output is not None and not isinstance(output, Jobs.PipedJob) + + cmd_args.append('-o') + # NOTE: gcc uses a temp .s file for this, but there + # doesn't seem to be a good reason. + cmd_args.append('/dev/null') + + cmd_args.append('--output-pch=') + cmd_args.append(arglist.getValue(output)) + jobs.addJob(Jobs.Command(self.toolChain.getProgramPath(cc1Name), cmd_args)) |

