aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-size/llvm-size.cpp
diff options
context:
space:
mode:
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 32d10ab..e422e69 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];