зеркало из https://github.com/microsoft/clang-1.git
ccc: Implement the rest of Darwin/Assembler argument translation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62081 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
4a0ba1aac1
Коммит
996ce9646a
|
@ -146,6 +146,9 @@ class ValueArg(Arg):
|
|||
def getValue(self, args):
|
||||
abstract
|
||||
|
||||
def getValues(self, args):
|
||||
return [self.getValue(args)]
|
||||
|
||||
class PositionalArg(ValueArg):
|
||||
"""PositionalArg - A simple positional argument."""
|
||||
|
||||
|
@ -262,6 +265,16 @@ class ArgList:
|
|||
if arg.opt is option:
|
||||
yield arg
|
||||
|
||||
def getArgs2(self, optionA, optionB):
|
||||
"""getArgs2 - Iterate over all arguments for two options, in
|
||||
the order they were specified."""
|
||||
# As long as getArgs is efficient, we can easily make this
|
||||
# efficient by iterating both at once and always taking the
|
||||
# earlier arg.
|
||||
for arg in self.args:
|
||||
if arg.opt in (optionA, optionB):
|
||||
yield arg
|
||||
|
||||
def getLastArg(self, option):
|
||||
return self.lastArgs.get(option)
|
||||
|
||||
|
@ -430,8 +443,8 @@ class OptionParser:
|
|||
|
||||
# Blanket pass-through options.
|
||||
|
||||
self.addOption(CommaJoinedOption('-Wa,'))
|
||||
self.addOption(SeparateOption('-Xassembler'))
|
||||
self.WaOption = self.addOption(CommaJoinedOption('-Wa,'))
|
||||
self.XassemblerOption = self.addOption(SeparateOption('-Xassembler'))
|
||||
|
||||
self.addOption(CommaJoinedOption('-Wp,'))
|
||||
self.addOption(SeparateOption('-Xpreprocessor'))
|
||||
|
@ -600,8 +613,12 @@ class OptionParser:
|
|||
# FIXME: Naming convention.
|
||||
self.dOption = self.addOption(FlagOption('-d'))
|
||||
self.addOption(JoinedOption('-d'))
|
||||
self.addOption(JoinedOption('-g'))
|
||||
|
||||
# Take care on extension, the Darwin assembler wants to add a
|
||||
# flag for any -g* option.
|
||||
self.gOption = self.addOption(JoinedOption('-g'))
|
||||
|
||||
self.f_appleKextOption = self.addOption(FlagOption('-fapple-kext'))
|
||||
self.f_exceptionsOption = self.addOption(FlagOption('-fexceptions'))
|
||||
self.f_objcOption = self.addOption(FlagOption('-fobjc'))
|
||||
self.f_openmpOption = self.addOption(FlagOption('-fopenmp'))
|
||||
|
@ -619,6 +636,7 @@ class OptionParser:
|
|||
self.m_64Option = self.addOption(FlagOption('-m64'))
|
||||
self.m_iphoneosVersionMinOption = self.addOption(JoinedOption('-miphoneos-version-min='))
|
||||
self.m_macosxVersionMinOption = self.addOption(JoinedOption('-mmacosx-version-min='))
|
||||
self.m_kernelOption = self.addOption(FlagOption('-mkernel'))
|
||||
|
||||
# Ugh. Need to disambiguate our naming convetion. -m x goes to
|
||||
# the linker sometimes, wheres -mxxxx is used for a variety of
|
||||
|
|
|
@ -112,14 +112,32 @@ class DarwinAssembleTool(Tool):
|
|||
input = inputs[0]
|
||||
|
||||
cmd_args = []
|
||||
|
||||
if arglist.getLastArg(arglist.parser.gOption):
|
||||
cmd_args.append('--gstabs')
|
||||
|
||||
# Derived from asm spec.
|
||||
if arch:
|
||||
cmd_args.extend(arglist.render(arch))
|
||||
cmd_args.append('-force_cpusubtype_ALL')
|
||||
cmd_args.extend(arglist.render(output))
|
||||
if (arglist.getLastArg(arglist.parser.m_kernelOption) or
|
||||
arglist.getLastArg(arglist.parser.staticOption) or
|
||||
arglist.getLastArg(arglist.parser.f_appleKextOption)):
|
||||
if not arglist.getLastArg(arglist.parser.ZdynamicOption):
|
||||
cmd_args.append('-static')
|
||||
|
||||
for arg in arglist.getArgs2(arglist.parser.WaOption,
|
||||
arglist.parser.XassemblerOption):
|
||||
cmd_args.extend(arglist.getValues(arg))
|
||||
|
||||
if isinstance(input.source, Jobs.PipedJob):
|
||||
cmd_args.append('-')
|
||||
else:
|
||||
cmd_args.extend(arglist.renderAsInput(input.source))
|
||||
|
||||
# asm_final spec is empty.
|
||||
|
||||
jobs.addJob(Jobs.Command('as', cmd_args))
|
||||
|
||||
class GCC_AssembleTool(GCC_Common_Tool):
|
||||
|
|
Загрузка…
Ссылка в новой задаче