[PATCH] D157241: [llvm-rc] Resolve the executable path if not present in Argv[0]

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 12:37:46 PDT 2023


mstorsjo added a comment.

Thanks for the review!



================
Comment at: llvm/tools/llvm-rc/llvm-rc.cpp:141
+  void *P = (void*) (intptr_t) findClang;
+  std::string MainExecPath = llvm::sys::fs::getMainExecutable(Argv0, P);
+  if (MainExecPath.empty())
----------------
thieta wrote:
> You can just pass `nullptr` to `getMainExecutable` instead of a symbol, unless there is a good reason here (I don't think so?).
As far as I know, the address argument can be used for resolving the main executable as a late fallback implementation - see https://github.com/llvm/llvm-project/blob/llvmorg-17.0.0-rc1/llvm/lib/Support/Unix/Path.inc#L323. If we pass nullptr there, the `getMainExecutable` function won't work in that particular codepath.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157241



More information about the llvm-commits mailing list