[llvm] r363201 - Sanitize llvm-extract -help output
Serge Guelton via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 14:08:19 PDT 2019
Author: serge_sans_paille
Date: Wed Jun 12 14:08:19 2019
New Revision: 363201
URL: http://llvm.org/viewvc/llvm-project?rev=363201&view=rev
Log:
Sanitize llvm-extract -help output
Filter out irrelevant options
New output:
OVERVIEW: llvm extractor
USAGE: llvm-extract [options] <input bitcode file>
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-extract Options:
--alias=<alias> - Specify alias to extract
--bb=<function:bb> - Specify <function, basic block> pairs to extract
--delete - Delete specified Globals from Module
-f - Enable binary output on terminals
--func=<function> - Specify function to extract
--glob=<global> - Specify global to extract
-o=<filename> - Specify output filename
--ralias=<ralias> - Specify alias(es) to extract using a regular expression
--recursive - Recursively extract all called functions
--rfunc=<rfunction> - Specify function(s) to extract using a regular expression
--rglob=<rglobal> - Specify global(s) to extract using a regular expression
Differential Revision: https://reviews.llvm.org/D62511
Modified:
llvm/trunk/tools/llvm-extract/llvm-extract.cpp
Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=363201&r1=363200&r2=363201&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original)
+++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Wed Jun 12 14:08:19 2019
@@ -33,86 +33,99 @@
#include <memory>
using namespace llvm;
-// InputFilename - The filename to read from.
-static cl::opt<std::string>
-InputFilename(cl::Positional, cl::desc("<input bitcode file>"),
- cl::init("-"), cl::value_desc("filename"));
-
-static cl::opt<std::string>
-OutputFilename("o", cl::desc("Specify output filename"),
- cl::value_desc("filename"), cl::init("-"));
-
-static cl::opt<bool>
-Force("f", cl::desc("Enable binary output on terminals"));
+cl::OptionCategory ExtractCat("llvm-extract Options");
-static cl::opt<bool>
-DeleteFn("delete", cl::desc("Delete specified Globals from Module"));
+// InputFilename - The filename to read from.
+static cl::opt<std::string> InputFilename(cl::Positional,
+ cl::desc("<input bitcode file>"),
+ cl::init("-"),
+ cl::value_desc("filename"));
+
+static cl::opt<std::string> OutputFilename("o",
+ cl::desc("Specify output filename"),
+ cl::value_desc("filename"),
+ cl::init("-"), cl::cat(ExtractCat));
+
+static cl::opt<bool> Force("f", cl::desc("Enable binary output on terminals"),
+ cl::cat(ExtractCat));
+
+static cl::opt<bool> DeleteFn("delete",
+ cl::desc("Delete specified Globals from Module"),
+ cl::cat(ExtractCat));
static cl::opt<bool>
- 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<std::string>
-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<std::string>
-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<std::string>
- ExtractBlocks("bb",
- cl::desc("Specify <function, basic block> pairs to extract"),
- cl::ZeroOrMore, cl::value_desc("function:bb"));
+static cl::list<std::string> ExtractBlocks(
+ "bb", cl::desc("Specify <function, basic block> pairs to extract"),
+ cl::ZeroOrMore, cl::value_desc("function:bb"), cl::cat(ExtractCat));
// ExtractAlias - The alias to extract from the module.
static cl::list<std::string>
-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<std::string>
-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<std::string>
-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<std::string>
-ExtractRegExpGlobals("rglob", cl::desc("Specify global(s) to extract using a "
- "regular expression"),
- cl::ZeroOrMore, cl::value_desc("rglobal"));
-
-static cl::opt<bool>
-OutputAssembly("S",
- cl::desc("Write output as LLVM assembly"), cl::Hidden);
+ 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<bool> OutputAssembly("S",
+ cl::desc("Write output as LLVM assembly"),
+ cl::Hidden, cl::cat(ExtractCat));
static cl::opt<bool> 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<bool> 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.
More information about the llvm-commits
mailing list