[clang] [clang][driver] Use platform specific calls to get the executable absolute path (PR #68091)

Liviu Ionescu via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 10:32:38 PDT 2023


================
@@ -331,6 +340,56 @@ static void SetInstallDir(SmallVectorImpl<const char *> &argv,
   // path being a symlink.
   SmallString<128> InstalledPath(argv[0]);
 
+#if defined(__linux__)
----------------
ilg-ul wrote:

> Can we use `getMainExecutable()` instead?

Good point! 

> So is the problem here that SetInstallDir is called after the above (having constructed TheDriver). Resulting in InstalledDir being changed into being relative to the symlink?

When I first encountered this problem I tried to run a debug session to understand how things work, but got confused and in the end I patched `SetInstallDir` and for my needs it was ok, but since `getMainExecutable()` already does the job I'll reconsider and try to understand where the problem comes from.

https://github.com/llvm/llvm-project/pull/68091


More information about the cfe-commits mailing list