diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-01-11 22:42:24 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-01-11 22:42:24 +0000 |
| commit | 3b43cf6169abd1101a38b6e7d1ec8744397cc593 (patch) | |
| tree | 1b3de2e455168bd3a249c7fb621abe024796c5dd | |
| parent | 9722023df8dc1cddb4ec1c7fc29ee25ee96406c3 (diff) | |
| download | bcm5719-llvm-3b43cf6169abd1101a38b6e7d1ec8744397cc593.tar.gz bcm5719-llvm-3b43cf6169abd1101a38b6e7d1ec8744397cc593.zip | |
ccc: Add several convenience methods for argument translation.
llvm-svn: 62057
| -rw-r--r-- | clang/tools/ccc/ccclib/Arguments.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/tools/ccc/ccclib/Arguments.py b/clang/tools/ccc/ccclib/Arguments.py index 6c543294bf8..5c5320ffe47 100644 --- a/clang/tools/ccc/ccclib/Arguments.py +++ b/clang/tools/ccc/ccclib/Arguments.py @@ -234,6 +234,34 @@ class ArgList: raise RuntimeError,'Unknown source ID for index.' + def addLastArg(self, output, option): + """addLastArgs - Extend the given output vector with the last + instance of a given option.""" + arg = self.getLastArg(option) + if arg: + output.extend(self.render(arg)) + + def addAllArgs(self, output, option): + """addAllArgs - Extend the given output vector with all + instances of a given option.""" + for arg in self.getArgs(option): + output.extend(self.render(arg)) + + def addAllArgsTranslated(self, output, option, translation): + """addAllArgsTranslated - Extend the given output vector with + all instances of a given option, rendered as separate + arguments with the actual option name translated to a user + specified string. For example, '-foox' will be render as + ['-bar', 'x'] if '-foo' was the option and '-bar' was the + translation. + + This routine expects that the option can only yield ValueArg + instances.""" + for arg in self.getArgs(option): + assert isinstance(arg, ValueArg) + output.append(translation) + output.append(self.getValue(arg)) + def makeIndex(self, *strings): pos = len(self.syntheticArgv) self.syntheticArgv.extend(strings) @@ -466,6 +494,7 @@ class OptionParser: self.Zsegs_read_only_addrOption = self.addOption(JoinedOrSeparateOption('-Zsegs_read_only_addr')) self.Zsegs_read_write_addrOption = self.addOption(JoinedOrSeparateOption('-Zsegs_read_write_addr')) self.Zsingle_moduleOption = self.addOption(FlagOption('-Zsingle_module')) + self.ZumbrellaOption = self.addOption(JoinedOrSeparateOption('-Zumbrella')) self.Zunexported_symbols_listOption = self.addOption(JoinedOrSeparateOption('-Zunexported_symbols_list')) self.Zweak_reference_mismatchesOption = self.addOption(JoinedOrSeparateOption('-Zweak_reference_mismatches')) |

