diff --git a/llvm/tools/llvm-extract/llvm-extract.cpp b/llvm/tools/llvm-extract/llvm-extract.cpp index 1aa52d97561d..300bc0b4bd52 100644 --- a/llvm/tools/llvm-extract/llvm-extract.cpp +++ b/llvm/tools/llvm-extract/llvm-extract.cpp @@ -33,86 +33,99 @@ #include using namespace llvm; +cl::OptionCategory ExtractCat("llvm-extract Options"); + // InputFilename - The filename to read from. -static cl::opt -InputFilename(cl::Positional, cl::desc(""), - cl::init("-"), cl::value_desc("filename")); +static cl::opt InputFilename(cl::Positional, + cl::desc(""), + cl::init("-"), + cl::value_desc("filename")); -static cl::opt -OutputFilename("o", cl::desc("Specify output filename"), - cl::value_desc("filename"), cl::init("-")); +static cl::opt OutputFilename("o", + cl::desc("Specify output filename"), + cl::value_desc("filename"), + cl::init("-"), cl::cat(ExtractCat)); + +static cl::opt Force("f", cl::desc("Enable binary output on terminals"), + cl::cat(ExtractCat)); + +static cl::opt DeleteFn("delete", + cl::desc("Delete specified Globals from Module"), + cl::cat(ExtractCat)); static cl::opt -Force("f", cl::desc("Enable binary output on terminals")); - -static cl::opt -DeleteFn("delete", cl::desc("Delete specified Globals from Module")); - -static cl::opt - Recursive("recursive", - cl::desc("Recursively extract all called functions")); + Recursive("recursive", cl::desc("Recursively extract all called functions"), + cl::cat(ExtractCat)); // ExtractFuncs - The functions to extract from the module. static cl::list -ExtractFuncs("func", cl::desc("Specify function to extract"), - cl::ZeroOrMore, cl::value_desc("function")); + ExtractFuncs("func", cl::desc("Specify function to extract"), + cl::ZeroOrMore, cl::value_desc("function"), + cl::cat(ExtractCat)); // ExtractRegExpFuncs - The functions, matched via regular expression, to // extract from the module. static cl::list -ExtractRegExpFuncs("rfunc", cl::desc("Specify function(s) to extract using a " - "regular expression"), - cl::ZeroOrMore, cl::value_desc("rfunction")); + ExtractRegExpFuncs("rfunc", + cl::desc("Specify function(s) to extract using a " + "regular expression"), + cl::ZeroOrMore, cl::value_desc("rfunction"), + cl::cat(ExtractCat)); // ExtractBlocks - The blocks to extract from the module. -static cl::list - ExtractBlocks("bb", - cl::desc("Specify pairs to extract"), - cl::ZeroOrMore, cl::value_desc("function:bb")); +static cl::list ExtractBlocks( + "bb", cl::desc("Specify pairs to extract"), + cl::ZeroOrMore, cl::value_desc("function:bb"), cl::cat(ExtractCat)); // ExtractAlias - The alias to extract from the module. static cl::list -ExtractAliases("alias", cl::desc("Specify alias to extract"), - cl::ZeroOrMore, cl::value_desc("alias")); - + ExtractAliases("alias", cl::desc("Specify alias to extract"), + cl::ZeroOrMore, cl::value_desc("alias"), + cl::cat(ExtractCat)); // ExtractRegExpAliases - The aliases, matched via regular expression, to // extract from the module. static cl::list -ExtractRegExpAliases("ralias", cl::desc("Specify alias(es) to extract using a " - "regular expression"), - cl::ZeroOrMore, cl::value_desc("ralias")); + ExtractRegExpAliases("ralias", + cl::desc("Specify alias(es) to extract using a " + "regular expression"), + cl::ZeroOrMore, cl::value_desc("ralias"), + cl::cat(ExtractCat)); // ExtractGlobals - The globals to extract from the module. static cl::list -ExtractGlobals("glob", cl::desc("Specify global to extract"), - cl::ZeroOrMore, cl::value_desc("global")); + ExtractGlobals("glob", cl::desc("Specify global to extract"), + cl::ZeroOrMore, cl::value_desc("global"), + cl::cat(ExtractCat)); // ExtractRegExpGlobals - The globals, matched via regular expression, to // extract from the module... static cl::list -ExtractRegExpGlobals("rglob", cl::desc("Specify global(s) to extract using a " - "regular expression"), - cl::ZeroOrMore, cl::value_desc("rglobal")); + ExtractRegExpGlobals("rglob", + cl::desc("Specify global(s) to extract using a " + "regular expression"), + cl::ZeroOrMore, cl::value_desc("rglobal"), + cl::cat(ExtractCat)); -static cl::opt -OutputAssembly("S", - cl::desc("Write output as LLVM assembly"), cl::Hidden); +static cl::opt OutputAssembly("S", + cl::desc("Write output as LLVM assembly"), + cl::Hidden, cl::cat(ExtractCat)); static cl::opt PreserveBitcodeUseListOrder( "preserve-bc-uselistorder", cl::desc("Preserve use-list order when writing LLVM bitcode."), - cl::init(true), cl::Hidden); + cl::init(true), cl::Hidden, cl::cat(ExtractCat)); static cl::opt PreserveAssemblyUseListOrder( "preserve-ll-uselistorder", cl::desc("Preserve use-list order when writing LLVM assembly."), - cl::init(false), cl::Hidden); + cl::init(false), cl::Hidden, cl::cat(ExtractCat)); int main(int argc, char **argv) { InitLLVM X(argc, argv); LLVMContext Context; + cl::HideUnrelatedOptions(ExtractCat); cl::ParseCommandLineOptions(argc, argv, "llvm extractor\n"); // Use lazy loading, since we only care about selected global values.