diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp --- 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 -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 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 + 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 TotalObjectTotal = 0; cl::opt -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 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 -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 @@ "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 -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 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 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 -InputFilenames(cl::Positional, cl::desc(""), cl::ZeroOrMore); + InputFilenames(cl::Positional, cl::desc(""), cl::ZeroOrMore); static bool HadError = false; @@ -860,6 +865,7 @@ 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];