diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-03-11 23:07:54 +0000 | 
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-11 23:07:54 +0000 | 
| commit | d295bf1d4684e4795cbe11242d4e47a3e34653ad (patch) | |
| tree | 5df24230ebe4b91a42dba9eef6ad92df9f06d626 /clang/tools/ccc | |
| parent | 65fe8349c6ad53bc5a4157dfc9e88d0a0754060d (diff) | |
| download | bcm5719-llvm-d295bf1d4684e4795cbe11242d4e47a3e34653ad.tar.gz bcm5719-llvm-d295bf1d4684e4795cbe11242d4e47a3e34653ad.zip | |
ccc: -x assembler-with-cpp was broken for darwin, and it wasn't using
clang as the preprocessor even when it should.
llvm-svn: 66737
Diffstat (limited to 'clang/tools/ccc')
| -rw-r--r-- | clang/tools/ccc/ccclib/ToolChain.py | 4 | ||||
| -rw-r--r-- | clang/tools/ccc/ccclib/Tools.py | 12 | ||||
| -rw-r--r-- | clang/tools/ccc/ccclib/Types.py | 17 | ||||
| -rw-r--r-- | clang/tools/ccc/test/ccc/darwin-x86-cc1.m | 9 | 
4 files changed, 30 insertions, 12 deletions
| diff --git a/clang/tools/ccc/ccclib/ToolChain.py b/clang/tools/ccc/ccclib/ToolChain.py index 8c71789e174..d081f28d19a 100644 --- a/clang/tools/ccc/ccclib/ToolChain.py +++ b/clang/tools/ccc/ccclib/ToolChain.py @@ -57,14 +57,14 @@ class ToolChain(object):      def shouldUseClangCompiler(self, action):          # If user requested no clang, or this isn't a "compile" phase, -        # or this isn't a C family option, then don't use clang. +        # or this isn't an input clang understands, then don't use clang.          if (self.driver.cccNoClang or               not isinstance(action.phase, (Phases.PreprocessPhase,                                            Phases.CompilePhase,                                            Phases.SyntaxOnlyPhase,                                            Phases.EmitLLVMPhase,                                            Phases.PrecompilePhase)) or -            action.inputs[0].type not in Types.cTypesSet): +            action.inputs[0].type not in Types.clangableTypesSet):              return False          if self.driver.cccNoClangPreprocessor: diff --git a/clang/tools/ccc/ccclib/Tools.py b/clang/tools/ccc/ccclib/Tools.py index 53fe38df21b..f4b8683837e 100644 --- a/clang/tools/ccc/ccclib/Tools.py +++ b/clang/tools/ccc/ccclib/Tools.py @@ -193,7 +193,13 @@ class Clang_CompileTool(Tool):          elif outputType is Types.LLVMBCType:              cmd_args.append('-emit-llvm-bc')          elif outputType is Types.AsmTypeNoPP: -            cmd_args.append('-S') +            # FIXME: This is hackish, it would be better if we had the +            # action instead of just looking at types. +            assert len(inputs) == 1 +            if inputs[0].type is Types.AsmType: +                cmd_args.append('-E') +            else: +                cmd_args.append('-S')          elif (inputs[0].type.preprocess and                 outputType is inputs[0].type.preprocess):              cmd_args.append('-E') @@ -453,7 +459,9 @@ class Darwin_X86_CC1Tool(Tool):          """getCC1Name(type) -> name, use-cpp, is-cxx"""          # FIXME: Get bool results from elsewhere. -        if type is Types.CType or type is Types.CHeaderType: +        if type is Types.AsmType: +            return 'cc1',True,False +        elif type is Types.CType or type is Types.CHeaderType:              return 'cc1',True,False          elif type is Types.CTypeNoPP or type is Types.CHeaderNoPPType:              return 'cc1',False,False diff --git a/clang/tools/ccc/ccclib/Types.py b/clang/tools/ccc/ccclib/Types.py index 94c00410da6..77e7907faec 100644 --- a/clang/tools/ccc/ccclib/Types.py +++ b/clang/tools/ccc/ccclib/Types.py @@ -148,14 +148,15 @@ kTypeSpecifierMap = {  }  # Set of C family types. -cTypesSet = set([CType, CTypeNoPP,  -                 ObjCType, ObjCTypeNoPP, -                 CXXType, CXXTypeNoPP, -                 ObjCXXType, ObjCXXTypeNoPP, -                 CHeaderType, CHeaderNoPPType, -                 ObjCHeaderType, ObjCHeaderNoPPType, -                 CXXHeaderType, CXXHeaderNoPPType, -                 ObjCXXHeaderType, ObjCXXHeaderNoPPType]) +clangableTypesSet = set([AsmType, # Assembler to preprocess +                         CType, CTypeNoPP,  +                         ObjCType, ObjCTypeNoPP, +                         CXXType, CXXTypeNoPP, +                         ObjCXXType, ObjCXXTypeNoPP, +                         CHeaderType, CHeaderNoPPType, +                         ObjCHeaderType, ObjCHeaderNoPPType, +                         CXXHeaderType, CXXHeaderNoPPType, +                         ObjCXXHeaderType, ObjCXXHeaderNoPPType])  # Set of C++ family types.  cxxTypesSet = set([CXXType, CXXTypeNoPP, diff --git a/clang/tools/ccc/test/ccc/darwin-x86-cc1.m b/clang/tools/ccc/test/ccc/darwin-x86-cc1.m index d00f85554fe..c9102caf9b0 100644 --- a/clang/tools/ccc/test/ccc/darwin-x86-cc1.m +++ b/clang/tools/ccc/test/ccc/darwin-x86-cc1.m @@ -11,5 +11,14 @@  // RUN: xcc -ccc-no-clang -ccc-host-bits 32 -ccc-host-machine i386 -ccc-host-system darwin -ccc-host-release 10.5.0 -### -x objective-c-header %s -o /tmp/x.gch &> %t.opts &&  // RUN: grep ' "/usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1obj" "-quiet" "-D__DYNAMIC__" ".*darwin-x86-cc1.m" "-fPIC" "-quiet" "-dumpbase" "darwin-x86-cc1.m" "-mmacosx-version-min=10.6.5" "-mtune=core2" "-auxbase" ".*" "-o" "/dev/null" "--output-pch=" "/tmp/x.gch"' %t.opts && +// RUN: touch %t.s && +// RUN: xcc -ccc-no-clang -ccc-host-bits 32 -ccc-host-machine i386 -ccc-host-system darwin -ccc-host-release 10.5.0 -### -c -x assembler %t.s &> %t.opts && +// RUN: grep /cc1 %t.opts | count 0 && +// RUN: grep ' "/usr/libexec/gcc/i686-apple-darwin10/4.2.1/as" "-arch" "i386" "-force_cpusubtype_ALL" "-o" ".*darwin-x86-cc1.m.out.tmp.s"' %t.opts && + +// RUN: xcc -ccc-no-clang -ccc-host-bits 32 -ccc-host-machine i386 -ccc-host-system darwin -ccc-host-release 10.5.0 -### -c -x assembler-with-cpp %t.s &> %t.opts && +// RUN: grep ' "/usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1" "-E" "-quiet" "-D__DYNAMIC__" ".*darwin-x86-cc1.m.out.tmp.s" "-o" ".*" "-fPIC" "-mmacosx-version-min=10.6.5" "-mtune=core2"' %t.opts && +// RUN: grep ' "/usr/libexec/gcc/i686-apple-darwin10/4.2.1/as" "-arch" "i386" "-force_cpusubtype_ALL" "-o" ".*"' %t.opts && +  // RUN: true | 

