[PATCH] D76733: New symbolizer option to print files relative to the compilation directory.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 02:07:54 PDT 2020


jhenderson added a comment.

With all of our tools with GNU equivalents, we should avoid single letter aliases unless we can get GNU to buy into the new option too. Long names are less of an issue, as it's unlikely we'll end up with a clash.

Please add the option to the llvm-symbolizer and llvm-addr2line docs.

Could you post a quick output comparison please for with and without this option? I'm finding it hard to properly visualise the behaviour from the test.



================
Comment at: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:81
+// -relativenames
+static cl::opt<bool> ClRelativenames("relativenames", cl::init(false),
+                                     cl::desc("Strip the compilation directory from paths"));
----------------
clang-format appears to be complaining.


================
Comment at: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:83
+                                     cl::desc("Strip the compilation directory from paths"));
+// Gnu addr2line uses -r for something else. No need for a short option.
+
----------------
No need for this comment.


================
Comment at: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp:318-323
+  // If both --basenames and --relativenames are specified then pick the last
+  // one.
+  if (ClBasenames.getPosition() > ClRelativenames.getPosition())
     Opts.PathStyle = DILineInfoSpecifier::FileLineInfoKind::BaseNameOnly;
+  else if (ClRelativenames)
+    Opts.PathStyle = DILineInfoSpecifier::FileLineInfoKind::RelativeFilePath;
----------------
This "pick last" behaviour needs testing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76733





More information about the llvm-commits mailing list