[cfe-commits] r62089 - in /cfe/trunk/tools/ccc/ccclib: Arguments.py Tools.py
Daniel Dunbar
daniel at zuster.org
Mon Jan 12 09:53:20 PST 2009
Author: ddunbar
Date: Mon Jan 12 11:53:19 2009
New Revision: 62089
URL: http://llvm.org/viewvc/llvm-project?rev=62089&view=rev
Log:
ccc: (Darwin) More argument translation for Darwin/Compile tool.
Modified:
cfe/trunk/tools/ccc/ccclib/Arguments.py
cfe/trunk/tools/ccc/ccclib/Tools.py
Modified: cfe/trunk/tools/ccc/ccclib/Arguments.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Arguments.py?rev=62089&r1=62088&r2=62089&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Arguments.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Arguments.py Mon Jan 12 11:53:19 2009
@@ -452,7 +452,10 @@
# FIXME: Weird, gcc claims this here in help but I'm not sure why;
# perhaps interaction with preprocessor? Investigate.
- self.addOption(JoinedOption('-std='))
+
+ # FIXME: This is broken in Darwin cc1, it wants std* and this
+ # is std=. May need an option group for this as well.
+ self.stdOption = self.addOption(JoinedOption('-std='))
self.addOption(JoinedOrSeparateOption('--sysroot'))
# Version control
@@ -484,7 +487,7 @@
self.MTOption = self.addOption(JoinedOrSeparateOption('-MT'))
self.MQOption = self.addOption(JoinedOrSeparateOption('-MQ'))
self.MachOption = self.addOption(FlagOption('-Mach'))
- self.addOption(FlagOption('-undef'))
+ self.undefOption = self.addOption(FlagOption('-undef'))
self.wOption = self.addOption(FlagOption('-w'))
self.addOption(JoinedOrSeparateOption('-allowable_client'))
@@ -535,6 +538,7 @@
self.addOption(FlagOption('-R'))
self.POption = self.addOption(FlagOption('-P'))
self.QOption = self.addOption(FlagOption('-Q'))
+ self.QnOption = self.addOption(FlagOption('-Qn'))
self.addOption(FlagOption('-all_load'))
self.addOption(FlagOption('--constant-cfstrings'))
self.traditionalOption = self.addOption(FlagOption('-traditional'))
@@ -597,9 +601,8 @@
self.eOption = self.addOption(JoinedOrSeparateOption('-e'))
self.rOption = self.addOption(JoinedOrSeparateOption('-r'))
- # Is this actually declared anywhere? I can only find it in a
- # spec. :(
self.pgOption = self.addOption(FlagOption('-pg'))
+ self.pOption = self.addOption(FlagOption('-p'))
doNotReallySupport = 1
if doNotReallySupport:
@@ -650,6 +653,10 @@
self.g3Option = self.addOption(JoinedOption('-g3'))
self.gOption = self.addOption(JoinedOption('-g'))
+ self.fastOption = self.addOption(FlagOption('-fast'))
+ self.fastfOption = self.addOption(FlagOption('-fastf'))
+ self.fastcpOption = self.addOption(FlagOption('-fastcp'))
+
self.f_appleKextOption = self.addOption(FlagOption('-fapple-kext'))
self.f_exceptionsOption = self.addOption(FlagOption('-fexceptions'))
self.f_objcOption = self.addOption(FlagOption('-fobjc'))
@@ -679,12 +686,16 @@
self.mOption = self.addOption(SeparateOption('-m'))
self.addOption(JoinedOption('-m'))
+ self.ansiOption = self.addOption(FlagOption('-ansi'))
+ self.trigraphsOption = self.addOption(FlagOption('-trigraphs'))
+ self.pedanticOption = self.addOption(FlagOption('-pedantic'))
self.addOption(JoinedOption('-i'))
- self.addOption(JoinedOption('-O'))
- self.addOption(JoinedOption('-W'))
+ self.OOption = self.addOption(JoinedOption('-O'))
+ self.WOption = self.addOption(JoinedOption('-W'))
# FIXME: Weird. This option isn't really separate, --param=a=b
- # works. An alias somewhere?
- self.addOption(SeparateOption('--param'))
+ # works. There is something else going on which interprets the
+ # '='.
+ self._paramOption = self.addOption(SeparateOption('--param'))
# FIXME: What is this? Seems to do something on Linux. I think
# only one is valid, but have a log that uses both.
Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=62089&r1=62088&r2=62089&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Mon Jan 12 11:53:19 2009
@@ -298,22 +298,91 @@
# FIXME: There is a spec command to remove
# -fpredictive-compilation args here. Investigate.
- # FIXME: cc1_options
+ # FIXME: This is from previously & not part of the spec,
+ # integrate properly.
+ for input in inputs:
+ if isinstance(input.source, Jobs.PipedJob):
+ cmd_args.append('-')
+ else:
+ cmd_args.extend(arglist.renderAsInput(input.source))
+
+ # Derived from cc1_options spec.
+ if (arglist.getLastArg(arglist.parser.fastOption) or
+ arglist.getLastArg(arglist.parser.fastfOption) or
+ arglist.getLastArg(arglist.parser.fastcpOption)):
+ cmd_args.append('-O3')
+
+ if (arglist.getLastArg(arglist.parser.pgOption) and
+ arglist.getLastArg(arglist.parser.f_omitFramePointerOption)):
+ raise ValueError,"-pg and -fomit-frame-pointer are incompatible"
+
+ # FIXME: cc1 spec
+
+ if not arglist.getLastArg(arglist.parser.QOption):
+ cmd_args.append('-quiet')
+
+ cmd_args.append('-dumpbase')
+ # FIXME: Get correct basename.
+ cmd_args.append('FIXME')
+
+ # FIXME: d*
+ # FIXME: m*
+ # FIXME: a*
+
+ # FIXME: This is wrong, what is supposed to happen is we
+ # should be using the immediate output if we have a "named
+ # output" from the user, and otherwise derive one from the
+ # input name.
+ outputOpt = arglist.getLastArg(arglist.parser.oOption)
+ if outputOpt:
+ cmd_args.append('-auxbase-strip')
+ cmd_args.append(arglist.getValue(outputOpt))
+ else:
+ cmd_args.append('-auxbase')
+ # FIXME: Add proper basename.
+ cmd_args.append('FIXME')
+
+ # FIXME: g*
+
+ arglist.addAllArgs(cmd_args, arglist.parser.OOption)
+ # FIXME: -Wall is getting some special treatment. Investigate.
+ arglist.addAllArgs2(cmd_args, arglist.parser.WOption, arglist.parser.pedanticOption)
+ arglist.addLastArg(cmd_args, arglist.parser.wOption)
+ arglist.addAllArgs3(cmd_args, arglist.parser.stdOption, arglist.parser.ansiOption, arglist.parser.trigraphsOption)
+ if arglist.getLastArg(arglist.parser.vOption):
+ cmd_args.append('-version')
+ if arglist.getLastArg(arglist.parser.pgOption):
+ cmd_args.append('-p')
+ arglist.addLastArg(cmd_args, arglist.parser.pOption)
+
+ # FIXME: f*
+
+ arglist.addLastArg(cmd_args, arglist.parser.undefOption)
+ if arglist.getLastArg(arglist.parser.QnOption):
+ cmd_args.append('-fno-ident')
+
+ # FIXME: This isn't correct.
+ #arglist.addLastArg(cmd_args, arglist.parser._helpOption)
+ #arglist.addLastArg(cmd_args, arglist.parser._targetHelpOption)
- if arch:
- cmd_args.extend(arglist.render(arch))
if isinstance(output, Jobs.PipedJob):
cmd_args.extend(['-o', '-'])
elif output is None:
- cmd_args.append('-fsyntax-only')
+ cmd_args.extend(['-o', '/dev/null'])
else:
cmd_args.extend(arglist.render(output))
-
- for input in inputs:
- if isinstance(input.source, Jobs.PipedJob):
- cmd_args.append('-')
- else:
- cmd_args.extend(arglist.renderAsInput(input.source))
+
+ # FIXME: Still don't get what is happening here. Investigate.
+ arglist.addAllArgs(cmd_args, arglist.parser._paramOption)
+
+ if (arglist.getLastArg(arglist.parser.f_mudflapOption) or
+ arglist.getLastArg(arglist.parser.f_mudflapthOption)):
+ cmd_args.append('-fno-builtin')
+ cmd_args.append('-fno-merge-constants')
+
+ if arglist.getLastArg(arglist.parser.coverageOption):
+ cmd_args.append('-fprofile-arcs')
+ cmd_args.append('-ftest-coverage')
jobs.addJob(Jobs.Command(self.toolChain.getProgramPath(cc1Name),
cmd_args))
More information about the cfe-commits
mailing list