summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-size/llvm-size.cpp
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@redhat.com>2019-06-05 10:32:28 +0000
committerSerge Guelton <sguelton@redhat.com>2019-06-05 10:32:28 +0000
commitdaeeb33f8601ed0ab88fc7a1b20088cb782b45e5 (patch)
treee2189aa0ce4f45863434a7150f945060def7b094 /llvm/tools/llvm-size/llvm-size.cpp
parentdb134aaec24e8a88fdac9b5015e7af8575b5cad6 (diff)
downloadbcm5719-llvm-daeeb33f8601ed0ab88fc7a1b20088cb782b45e5.tar.gz
bcm5719-llvm-daeeb33f8601ed0ab88fc7a1b20088cb782b45e5.zip
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
Diffstat (limited to 'llvm/tools/llvm-size/llvm-size.cpp')
-rw-r--r--llvm/tools/llvm-size/llvm-size.cpp58
1 files changed, 32 insertions, 26 deletions
diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp
index 32d10abe773..e422e69f785 100644
--- a/llvm/tools/llvm-size/llvm-size.cpp
+++ b/llvm/tools/llvm-size/llvm-size.cpp
@@ -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));
-
-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));
+ 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), 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];
OpenPOWER on IntegriCloud