[PATCH] D105330: [llvm-nm] Switch command line parsing from llvm::cl to OptTable

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 2 11:24:51 PDT 2021


aganea added inline comments.


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:87
+
+static bool ArchiveMap;
+static bool DebugSyms;
----------------
Can you take the opportunity and put all this onto a stack-based state class? So that the tool can be used as-a-lib & be thread-safe? A practical example could be usage of  `llvm/tools/llvm-shlib/gen-msvc-exports.py`, but in-process.


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:2128
   InitLLVM X(argc, argv);
-  cl::HideUnrelatedOptions(NMCat);
-  cl::AddExtraVersionPrinter(printExtraVersionInfo);
-  cl::ParseCommandLineOptions(argc, argv, "llvm symbol table dumper\n");
-
-  if (Version) {
+  BumpPtrAllocator A;
+  StringSaver Saver(A);
----------------
It looks like `L2128-L2151` are the same as D104889, `llvm/tools/llvm-strings/llvm-strings.cpp, L131-L151`. Is it worth putting this boilerplate in a small utility function in `llvm/Support/`, since we'll probably write the same thing for other bintools?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105330/new/

https://reviews.llvm.org/D105330



More information about the llvm-commits mailing list