[all-commits] [llvm/llvm-project] 8c6a0c: [llvm-rc] Resolve the executable path if not prese...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Tue Aug 8 13:20:36 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8c6a0c8bf50bca6c3a0c4de1b84f21466ee31655
      https://github.com/llvm/llvm-project/commit/8c6a0c8bf50bca6c3a0c4de1b84f21466ee31655
  Author: Martin Storsjö <martin at martin.st>
  Date:   2023-08-08 (Tue, 08 Aug 2023)

  Changed paths:
    M llvm/tools/llvm-rc/llvm-rc.cpp

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

The llvm-rc tool tries to locate a suitable Clang executable to
use for preprocessing. For this purpose, it first checks within
the same directory as the llvm-rc tool, checking with a couple
different names, followed by checking all of $PATH for another
couple names.

On Windows, the InitLLVM() function always sets up Argv[0] with the
full path to the executable, while on Unix, Argv[0] is kept as is.

Therefore, call getMainExecutable to try to resolve the directory of
the executable before looking for colocated Clang executables.

This makes 282744a9ce18120dc0a6eceb02693b36980d9498 actually have
the desired effect.

Differential Revision: https://reviews.llvm.org/D157241




More information about the All-commits mailing list