From: Daniel Dunbar Date: Tue, 13 Jan 2009 06:25:31 +0000 (+0000) Subject: ccc: Bug fix and gcc compatibility tweak. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7629053d7da21819f28840f61f0aadfc6533bec6;p=clang ccc: Bug fix and gcc compatibility tweak. - --gstabs only goes to Darwin/Assembler when dealing with an assembly file from the command line. - Relative placement of -o option for cc1 moves depending on -fsyntax-only/-S, how quaint. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62152 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/ccc/ccclib/Driver.py b/tools/ccc/ccclib/Driver.py index 46b4541fc4..75f48da886 100644 --- a/tools/ccc/ccclib/Driver.py +++ b/tools/ccc/ccclib/Driver.py @@ -573,7 +573,7 @@ class Driver(object): elif hasNoIntegratedCPP: self.claim(hasNoIntegratedCPP) - + # FIXME: Move to... somewhere else. class InputInfo: def __init__(self, source, type, baseInput): self.source = source @@ -583,6 +583,9 @@ class Driver(object): def __repr__(self): return '%s(%r, %r, %r)' % (self.__class__.__name__, self.source, self.type, self.baseInput) + + def isOriginalInput(self): + return self.source is self.baseInput def createJobs(tc, phase, forwardArgs, canAcceptPipe=False, atTopLevel=False, arch=None): diff --git a/tools/ccc/ccclib/Tools.py b/tools/ccc/ccclib/Tools.py index 57c8afc6bb..1140dee6b4 100644 --- a/tools/ccc/ccclib/Tools.py +++ b/tools/ccc/ccclib/Tools.py @@ -115,8 +115,10 @@ class Darwin_AssembleTool(Tool): cmd_args = [] - if arglist.getLastArg(arglist.parser.gGroup): - cmd_args.append('--gstabs') + # Bit of a hack, this is only used for original inputs. + if input.isOriginalInput(): + if arglist.getLastArg(arglist.parser.gGroup): + cmd_args.append('--gstabs') # Derived from asm spec. if arch: @@ -442,13 +444,20 @@ class Darwin_X86_CompileTool(Tool): #arglist.addLastArg(cmd_args, arglist.parser._helpOption) #arglist.addLastArg(cmd_args, arglist.parser._targetHelpOption) + # There is no need for this level of compatibility, but it + # makes diffing easier. + outputAtEnd = (not arglist.getLastArg(arglist.parser.syntaxOnlyOption) and + not arglist.getLastArg(arglist.parser.SOption)) if isinstance(output, Jobs.PipedJob): - cmd_args.extend(['-o', '-']) + output_args = ['-o', '-'] elif output is None: - cmd_args.extend(['-o', '/dev/null']) + output_args = ['-o', '/dev/null'] else: - cmd_args.extend(arglist.render(output)) - + output_args = arglist.render(output) + + if not outputAtEnd: + cmd_args.extend(output_args) + # FIXME: Still don't get what is happening here. Investigate. arglist.addAllArgs(cmd_args, arglist.parser._paramOption) @@ -461,6 +470,9 @@ class Darwin_X86_CompileTool(Tool): cmd_args.append('-fprofile-arcs') cmd_args.append('-ftest-coverage') + if outputAtEnd: + cmd_args.extend(output_args) + jobs.addJob(Jobs.Command(self.toolChain.getProgramPath(cc1Name), cmd_args))