1fe6060f1SDimitry Andricinclude "llvm/Option/OptParser.td"
2fe6060f1SDimitry Andric
3fe6060f1SDimitry Andricclass F<string letter, string help> : Flag<["-"], letter>, HelpText<help>;
4fe6060f1SDimitry Andricclass FF<string name, string help> : Flag<["--"], name>, HelpText<help>;
5fe6060f1SDimitry Andric
6fe6060f1SDimitry Andricmulticlass BB<string name, string help1, string help2> {
7fe6060f1SDimitry Andric  def NAME: Flag<["--"], name>, HelpText<help1>;
8fe6060f1SDimitry Andric  def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
9fe6060f1SDimitry Andric}
10fe6060f1SDimitry Andric
11fe6060f1SDimitry Andricmulticlass Eq<string name, string help> {
12fe6060f1SDimitry Andric  def NAME #_EQ : Joined<["--"], name #"=">, HelpText<help>;
13fe6060f1SDimitry Andric  def : Separate<["--"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
14fe6060f1SDimitry Andric}
15fe6060f1SDimitry Andric
1681ad6265SDimitry Andricdef X : JoinedOrSeparate<["-"], "X">, HelpText<"Specifies the type of ELF, XCOFF, or IR object file to examine. The value must be one of: 32, 64, 32_64, any (default)">;
17fe6060f1SDimitry Andricdef debug_syms : FF<"debug-syms", "Show all symbols, even debugger only">;
18fe6060f1SDimitry Andricdef defined_only : FF<"defined-only", "Show only defined symbols">;
19fe6060f1SDimitry Andricdefm demangle : BB<"demangle", "Demangle C++ symbol names", "Don't demangle symbol names">;
20fe6060f1SDimitry Andricdef dynamic : FF<"dynamic", "Display dynamic symbols instead of normal symbols">;
2181ad6265SDimitry Andricdef export_symbols : FF<"export-symbols", "Export symbol list for all inputs">;
22fe6060f1SDimitry Andricdef extern_only : FF<"extern-only", "Show only external symbols">;
23fe6060f1SDimitry Andricdefm format : Eq<"format", "Specify output format: bsd (default), posix, sysv, darwin, just-symbols">, MetaVarName<"<format>">;
24fe6060f1SDimitry Andricdef help : FF<"help", "Display this help">;
25*5f757f3fSDimitry Andricdef line_numbers : FF<"line-numbers", "Use debugging information to print symbols' filenames and line numbers">;
26fe6060f1SDimitry Andricdef no_llvm_bc : FF<"no-llvm-bc", "Disable LLVM bitcode reader">;
27fe6060f1SDimitry Andricdef no_sort : FF<"no-sort", "Show symbols in order encountered">;
28fe6060f1SDimitry Andricdef no_weak : FF<"no-weak", "Show only non-weak symbols">;
29fe6060f1SDimitry Andricdef numeric_sort : FF<"numeric-sort", "Sort symbols by address">;
30fe6060f1SDimitry Andricdef print_armap : FF<"print-armap", "Print the archive map">;
31fe6060f1SDimitry Andricdef print_file_name : FF<"print-file-name", "Precede each symbol with the object file it came from">;
32fe6060f1SDimitry Andricdef print_size : FF<"print-size", "Show symbol size as well as address">;
33fe6060f1SDimitry Andricdef quiet : FF<"quiet", "Suppress 'no symbols' diagnostic">;
34fe6060f1SDimitry Andricdefm radix : Eq<"radix", "Radix (o/d/x) for printing symbol Values">, MetaVarName<"<radix>">;
35fe6060f1SDimitry Andricdef reverse_sort : FF<"reverse-sort", "Sort in reverse order">;
36fe6060f1SDimitry Andricdef size_sort : FF<"size-sort", "Sort symbols by size">;
37fe6060f1SDimitry Andricdef special_syms : FF<"special-syms", "Do not filter special symbols from the output">;
38fe6060f1SDimitry Andricdef undefined_only : FF<"undefined-only", "Show only undefined symbols">;
39fe6060f1SDimitry Andricdef version : FF<"version", "Display the version">;
40fe6060f1SDimitry Andricdef without_aliases : FF<"without-aliases", "Exclude aliases from output">, Flags<[HelpHidden]>;
41fe6060f1SDimitry Andric
42fe6060f1SDimitry Andric// Mach-O specific options.
43fe6060f1SDimitry Andricdef grp_mach_o : OptionGroup<"kind">, HelpText<"llvm-nm Mach-O Specific Options">;
44fe6060f1SDimitry Andric
45fe6060f1SDimitry Andricdef add_dyldinfo : FF<"add-dyldinfo", "Add symbols from the dyldinfo not already in the symbol table">, Group<grp_mach_o>;
46fe6060f1SDimitry Andricdef add_inlinedinfo : FF<"add-inlinedinfo", "Add symbols from the inlined libraries, TBD only">, Group<grp_mach_o>;
47fe6060f1SDimitry Andricdef arch_EQ : Joined<["--"], "arch=">, HelpText<"architecture(s) from a Mach-O file to dump">, Group<grp_mach_o>;
48fe6060f1SDimitry Andricdef : Separate<["--", "-"], "arch">, Alias<arch_EQ>;
49fe6060f1SDimitry Andricdef dyldinfo_only : FF<"dyldinfo-only", "Show only symbols from the dyldinfo">, Group<grp_mach_o>;
50fe6060f1SDimitry Andricdef no_dyldinfo : FF<"no-dyldinfo", "Don't add any symbols from the dyldinfo">, Group<grp_mach_o>;
51fe6060f1SDimitry Andricdef s : F<"s", "Dump only symbols from this segment and section name">, Group<grp_mach_o>;
52fe6060f1SDimitry Andricdef x : F<"x", "Print symbol entry in hex">, Group<grp_mach_o>;
53fe6060f1SDimitry Andric
5481ad6265SDimitry Andric// XCOFF specific options.
5581ad6265SDimitry Andricdef grp_xcoff_o : OptionGroup<"kind">, HelpText<"llvm-nm XCOFF Specific Options">;
5681ad6265SDimitry Andric
5781ad6265SDimitry Andricdef no_rsrc : FF<"no-rsrc", "Exclude resource file symbols (__rsrc) from the export symbol list.">, Group<grp_xcoff_o>;
5881ad6265SDimitry Andric
59fe6060f1SDimitry Andricdef : FF<"just-symbol-name", "Alias for --format=just-symbols">, Alias<format_EQ>, AliasArgs<["just-symbols"]>, Flags<[HelpHidden]>;
60fe6060f1SDimitry Andricdef : FF<"portability", "Alias for --format=posix">, Alias<format_EQ>, AliasArgs<["posix"]>;
61fe6060f1SDimitry Andric
62fe6060f1SDimitry Andricdef : F<"a", "Alias for --debug-syms">, Alias<debug_syms>;
63fe6060f1SDimitry Andricdef : F<"A", "Alias for --print-file-name">, Alias<print_file_name>;
64fe6060f1SDimitry Andricdef : F<"B", "Alias for --format=bsd">, Alias<format_EQ>, AliasArgs<["bsd"]>;
65fe6060f1SDimitry Andricdef : F<"C", "Alias for --demangle">, Alias<demangle>;
66fe6060f1SDimitry Andricdef : F<"D", "Alias for --dynamic">, Alias<dynamic>;
67fe6060f1SDimitry Andricdef : JoinedOrSeparate<["-"], "f">, HelpText<"Alias for --format">, Alias<format_EQ>, MetaVarName<"<format>">;
68fe6060f1SDimitry Andricdef : F<"h", "Alias for --help">, Alias<help>;
69fe6060f1SDimitry Andricdef : F<"g", "Alias for --extern-only">, Alias<extern_only>;
70fe6060f1SDimitry Andricdef : F<"j", "Alias for --format=just-symbols">, Alias<format_EQ>, AliasArgs<["just-symbols"]>;
71*5f757f3fSDimitry Andricdef : F<"l", "Alias for --line-numbers">, Alias<line_numbers>;
72fe6060f1SDimitry Andricdef : F<"m", "Alias for --format=darwin">, Alias<format_EQ>, AliasArgs<["darwin"]>;
73fe6060f1SDimitry Andricdef : F<"M", "Deprecated alias for --print-armap">, Alias<print_armap>, Flags<[HelpHidden]>;
74fe6060f1SDimitry Andricdef : F<"n", "Alias for --numeric-sort">, Alias<numeric_sort>;
75fe6060f1SDimitry Andricdef : F<"o", "Alias for --print-file-name">, Alias<print_file_name>;
76fe6060f1SDimitry Andricdef : F<"p", "Alias for --no-sort">, Alias<no_sort>;
77fe6060f1SDimitry Andricdef : F<"P", "Alias for --format=posix">, Alias<format_EQ>, AliasArgs<["posix"]>;
78fe6060f1SDimitry Andricdef : F<"r", "Alias for --reverse-sort">, Alias<reverse_sort>;
79fe6060f1SDimitry Andricdef : F<"S", "Alias for --print-size">, Alias<print_size>;
80fe6060f1SDimitry Andricdef : JoinedOrSeparate<["-"], "t">, HelpText<"Alias for --radix">, Alias<radix_EQ>, MetaVarName<"<radix>">;
81fe6060f1SDimitry Andricdef : F<"u", "Alias for --undefined-only">, Alias<undefined_only>;
8281ad6265SDimitry Andricdef : F<"U", "Alias for --defined-only">, Alias<defined_only>;
83fe6060f1SDimitry Andricdef : F<"v", "Alias for --numeric-sort">, Alias<numeric_sort>;
84fe6060f1SDimitry Andricdef : F<"V", "Alias for --version">, Alias<version>;
8581ad6265SDimitry Andricdef : F<"W", "Alias for --no-weak">, Alias<no_weak>;
86