[cfe-commits] r62210 - in /cfe/trunk/tools/ccc/ccclib: Arguments.py Tools.py
Daniel Dunbar
daniel at zuster.org
Tue Jan 13 17:50:15 PST 2009
Author: ddunbar
Date: Tue Jan 13 19:50:15 2009
New Revision: 62210
URL: http://llvm.org/viewvc/llvm-project?rev=62210&view=rev
Log:
ccc: Implement argument translation for clang.
- This is what ccc (old) currently handles.
- Clang accepts some more things that aren't getting forwarded...
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=62210&r1=62209&r2=62210&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Arguments.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Arguments.py Tue Jan 13 19:50:15 2009
@@ -727,7 +727,11 @@
self.f_noEliminateUnusedDebugSymbolsOption = self.addOption(FlagOption('-fno-eliminate-unused-debug-symbols', self.fGroup))
self.f_exceptionsOption = self.addOption(FlagOption('-fexceptions', self.fGroup))
self.f_objcOption = self.addOption(FlagOption('-fobjc', self.fGroup))
+ self.f_objcGcOption = self.addOption(FlagOption('-fobjc-gc', self.fGroup))
+ self.f_objcGcOnlyOption = self.addOption(FlagOption('-fobjc-gc-only', self.fGroup))
self.f_openmpOption = self.addOption(FlagOption('-fopenmp', self.fGroup))
+ self.f_gnuRuntimeOption = self.addOption(FlagOption('-fgnu-runtime', self.fGroup))
+ self.f_nextRuntimeOption = self.addOption(FlagOption('-fnext-runtime', self.fGroup))
self.f_constantCfstringsOption = self.addOption(FlagOption('-fconstant-cfstrings', self.fGroup))
self.f_noConstantCfstringsOption = self.addOption(FlagOption('-fno-constant-cfstrings', self.fGroup))
self.f_pascalStringsOption = self.addOption(FlagOption('-fpascal-strings', self.fGroup))
Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=62210&r1=62209&r2=62210&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Tue Jan 13 19:50:15 2009
@@ -172,18 +172,60 @@
output, outputType, arglist,
[])
-class Clang_CompileTool(GCC_Common_Tool):
+class Clang_CompileTool(Tool):
def __init__(self):
super(Clang_CompileTool, self).__init__('clang',
- (Tool.eFlagsPipedInput |
- Tool.eFlagsPipedOutput |
- Tool.eFlagsIntegratedCPP))
+ (Tool.eFlagsPipedInput |
+ Tool.eFlagsPipedOutput |
+ Tool.eFlagsIntegratedCPP))
def constructJob(self, phase, arch, jobs, inputs,
output, outputType, arglist):
- return super(Clang_CompileTool, self).constructJob(phase, arch, jobs, inputs,
- output, outputType, arglist,
- ['-S'])
+ cmd_args = []
+
+ if output is None:
+ cmd_args.append('-fsyntax-only')
+ elif outputType is Types.AsmTypeNoPP:
+ cmd_args.append('-S')
+ else:
+ raise ValueError,"Unexpected output type for clang tool."
+
+ arglist.addAllArgs(cmd_args, arglist.parser.vOption)
+ arglist.addAllArgs(cmd_args, arglist.parser.f_objcGcOption)
+ arglist.addAllArgs(cmd_args, arglist.parser.f_objcGcOnlyOption)
+ arglist.addAllArgs(cmd_args, arglist.parser.f_nextRuntimeOption)
+ arglist.addAllArgs(cmd_args, arglist.parser.f_gnuRuntimeOption)
+ arglist.addAllArgs2(cmd_args, arglist.parser.DOption, arglist.parser.UOption)
+ arglist.addAllArgs2(cmd_args, arglist.parser.IOption, arglist.parser.FOption)
+ arglist.addAllArgs(cmd_args, arglist.parser.stdOption)
+ arglist.addAllArgs(cmd_args, arglist.parser.m_macosxVersionMinOption)
+
+ # Special case debug options to only pass -g to clang. This is
+ # wrong.
+ if arglist.getLastArg(arglist.parser.gGroup):
+ cmd_args.append('-g')
+
+ # FIXME: Clang isn't going to accept just anything here.
+ arglist.addAllArgs(cmd_args, arglist.parser.iGroup)
+
+ # FIXME: Dehardcode this.
+ cmd_args.append('-fblocks')
+
+ if arch is not None:
+ cmd_args.extend(arglist.render(arch))
+
+ cmd_args.extend(arglist.render(output))
+
+ for input in inputs:
+ cmd_args.append('-x')
+ cmd_args.append(input.type.name)
+ if isinstance(input.source, Jobs.PipedJob):
+ cmd_args.append('-')
+ else:
+ cmd_args.extend(arglist.renderAsInput(input.source))
+
+ jobs.addJob(Jobs.Command('clang', cmd_args))
+
class Darwin_X86_CompileTool(Tool):
def __init__(self, toolChain):
More information about the cfe-commits
mailing list