1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Sanitize llvm-size help

Remove irrelevant options from standard help output.

New output:

    OVERVIEW: llvm object size dumper

    USAGE: llvm-size [options] <input files>

    OPTIONS:

    Generic Options:

      --help           - Display available options (--help-hidden for more)
      --help-list      - Display list of available options (--help-list-hidden for more)
      --version        - Display the version of this program

    llvm-size Options:

      Specify output format
          -A             - System V format
          -B             - Berkeley format
          -m             - Darwin -m format
      --arch=<string>  - architecture(s) from a Mach-O file to dump
      --common         - Print common symbols in the ELF file.  When using Berkely format, this is added to bss.
      Print size in radix:
          -o             - Print size in octal
          -d             - Print size in decimal
          -x             - Print size in hexadecimal
      --format=<value> - Specify output format
        =sysv          -   System V format
        =berkeley      -   Berkeley format
        =darwin        -   Darwin -m format
      -l               - When format is darwin, use long format to include addresses and offsets.
      --radix=<value>  - Print size in radix
        =8             -   Print size in octal
        =10            -   Print size in decimal
        =16            -   Print size in hexadecimal
      --totals         - Print totals of all objects - Berkeley format only

Differential Revision: https://reviews.llvm.org/D62482

llvm-svn: 362593
This commit is contained in:
Serge Guelton 2019-06-05 10:32:28 +00:00
parent cd6d283cd6
commit 00fb8a8ca7

View File

@ -32,20 +32,22 @@
using namespace llvm;
using namespace object;
cl::OptionCategory SizeCat("llvm-size Options");
enum OutputFormatTy { berkeley, sysv, darwin };
static cl::opt<OutputFormatTy>
OutputFormat("format", cl::desc("Specify output format"),
cl::values(clEnumVal(sysv, "System V format"),
clEnumVal(berkeley, "Berkeley format"),
clEnumVal(darwin, "Darwin -m format")),
cl::init(berkeley));
OutputFormat("format", cl::desc("Specify output format"),
cl::values(clEnumVal(sysv, "System V format"),
clEnumVal(berkeley, "Berkeley format"),
clEnumVal(darwin, "Darwin -m format")),
cl::init(berkeley), cl::cat(SizeCat));
static cl::opt<OutputFormatTy> OutputFormatShort(
cl::desc("Specify output format"),
cl::values(clEnumValN(sysv, "A", "System V format"),
clEnumValN(berkeley, "B", "Berkeley format"),
clEnumValN(darwin, "m", "Darwin -m format")),
cl::init(berkeley));
static cl::opt<OutputFormatTy>
OutputFormatShort(cl::desc("Specify output format"),
cl::values(clEnumValN(sysv, "A", "System V format"),
clEnumValN(berkeley, "B", "Berkeley format"),
clEnumValN(darwin, "m", "Darwin -m format")),
cl::init(berkeley), cl::cat(SizeCat));
static bool BerkeleyHeaderPrinted = false;
static bool MoreThanOneFile = false;
@ -55,18 +57,20 @@ static uint64_t TotalObjectBss = 0;
static uint64_t TotalObjectTotal = 0;
cl::opt<bool>
DarwinLongFormat("l", cl::desc("When format is darwin, use long format "
"to include addresses and offsets."));
DarwinLongFormat("l",
cl::desc("When format is darwin, use long format "
"to include addresses and offsets."),
cl::cat(SizeCat));
cl::opt<bool>
ELFCommons("common",
cl::desc("Print common symbols in the ELF file. When using "
"Berkely format, this is added to bss."),
cl::init(false));
cl::init(false), cl::cat(SizeCat));
static cl::list<std::string>
ArchFlags("arch", cl::desc("architecture(s) from a Mach-O file to dump"),
cl::ZeroOrMore);
ArchFlags("arch", cl::desc("architecture(s) from a Mach-O file to dump"),
cl::ZeroOrMore, cl::cat(SizeCat));
static bool ArchAll = false;
enum RadixTy { octal = 8, decimal = 10, hexadecimal = 16 };
@ -74,25 +78,26 @@ static cl::opt<RadixTy> Radix(
"radix", cl::desc("Print size in radix"), cl::init(decimal),
cl::values(clEnumValN(octal, "8", "Print size in octal"),
clEnumValN(decimal, "10", "Print size in decimal"),
clEnumValN(hexadecimal, "16", "Print size in hexadecimal")));
clEnumValN(hexadecimal, "16", "Print size in hexadecimal")),
cl::cat(SizeCat));
static cl::opt<RadixTy>
RadixShort(cl::desc("Print size in radix:"),
cl::values(clEnumValN(octal, "o", "Print size in octal"),
clEnumValN(decimal, "d", "Print size in decimal"),
clEnumValN(hexadecimal, "x", "Print size in hexadecimal")),
cl::init(decimal));
static cl::opt<RadixTy> RadixShort(
cl::desc("Print size in radix:"),
cl::values(clEnumValN(octal, "o", "Print size in octal"),
clEnumValN(decimal, "d", "Print size in decimal"),
clEnumValN(hexadecimal, "x", "Print size in hexadecimal")),
cl::init(decimal), cl::cat(SizeCat));
static cl::opt<bool>
TotalSizes("totals",
cl::desc("Print totals of all objects - Berkeley format only"),
cl::init(false));
cl::init(false), cl::cat(SizeCat));
static cl::alias TotalSizesShort("t", cl::desc("Short for --totals"),
cl::aliasopt(TotalSizes));
static cl::list<std::string>
InputFilenames(cl::Positional, cl::desc("<input files>"), cl::ZeroOrMore);
InputFilenames(cl::Positional, cl::desc("<input files>"), cl::ZeroOrMore);
static bool HadError = false;
@ -860,6 +865,7 @@ static void printBerkelyTotals() {
int main(int argc, char **argv) {
InitLLVM X(argc, argv);
cl::HideUnrelatedOptions(SizeCat);
cl::ParseCommandLineOptions(argc, argv, "llvm object size dumper\n");
ToolName = argv[0];