[PATCH] D118633: [Symbolizer] Add Build ID flag to llvm-symbolizer.

Daniel Thornburgh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 8 12:31:40 PST 2022


mysterymath added inline comments.


================
Comment at: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:367-368
 
+  if (!Args.getLastArgValue(OPT_build_id_EQ).empty() &&
+      !Args.getLastArgValue(OPT_obj_EQ).empty()) {
+    errs() << "error: cannot specify both --build-id and --obj\n";
----------------
phosek wrote:
> I'd use `hasArg`.
There's a use to having a value that means "flag unset": you can unset flags via concatenation, which can help when using utilities in scripts. E.g., an environment variable is set up with a ton of flags outside your control, and you want to remove exactly one of them. This can require either some tricky string manipulation or just appending "--obj= ", depending on the semantics of '--obj'.

That being said, I did a quick random sampling of flags in LLVM, and it's wildly variable whether or not a given flag offers this property. At least some of that is probably due to GCC backcompat concerns, but it's definitely not a property a user can rely on across the board, so doesn't seem to be much point in making more flags behave that way.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118633



More information about the llvm-commits mailing list