[PATCH] D104889: [llvm-strings] Switch command line parsing from llvm::cl to OptTable
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 2 11:39:00 PDT 2021
MaskRay added inline comments.
================
Comment at: llvm/tools/llvm-strings/llvm-strings.cpp:70
-static cl::opt<bool>
- PrintFileName("print-file-name",
- cl::desc("Print the name of the file before each string"));
-static cl::alias PrintFileNameShort("f", cl::desc(""),
- cl::aliasopt(PrintFileName));
-
-static cl::opt<int>
- MinLength("bytes", cl::desc("Print sequences of the specified length"),
- cl::init(4));
-static cl::alias MinLengthShort("n", cl::desc(""), cl::aliasopt(MinLength));
-
-static cl::opt<bool>
- AllSections("all",
- cl::desc("Check all sections, not just the data section"));
-static cl::alias AllSectionsShort("a", cl::desc(""),
- cl::aliasopt(AllSections));
+static bool AllSections;
+static int MinLength = 4;
----------------
aganea wrote:
> Same comment as D105330, it would be nice if the globals were part a stack-based state instead.
I think the global options are fine. They are trivially copyable types. The variables are referenced by more than one function so not localizable straightforwardly.
This tool is not used as a library so global states don't matter as long as they don't collide with other tools.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104889/new/
https://reviews.llvm.org/D104889
More information about the llvm-commits
mailing list