[PATCH] D138334: Improve llvm-symbolizer search logic for symlink

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 12:41:23 PST 2022


aganea added inline comments.


================
Comment at: llvm/lib/Support/Signals.cpp:165
+    // parent directory as well.
+    if (llvm::sys::fs::is_symlink_file(Argv0)) {
+      llvm::SmallString<128> Resolved;
----------------
I feel adding the `paths` variable is adding complexity for future readers. Also, do we really need `is_symlink_file()`? Can we just call `real_path()`?
What about just this: (and keep the comment)
```
   if (!LLVMSymbolizerPathOrErr) {
      llvm::SmallString<128> Resolved;
      if (!llvm::sys::fs::real_path(Argv0, Resolved)) {
        Parent = llvm::sys::path::parent_path(Resolved);
        if (!Parent.empty())
          LLVMSymbolizerPathOrErr = sys::findProgramByName("llvm-symbolizer", Parent);
      }
   }
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138334



More information about the llvm-commits mailing list