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

Björn Pettersson via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 07:17:15 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__)
----------------
bjope wrote:

I was kind of thinking the same. And then started to wonder about why SetInstallDir says "We do this manually, because we want to support that path being a symlink.". I don't really understand if that indicates that the installed dir should be set based on the symlinks path or not.

Afaict `Driver::ClangExecutable` already is computed via `getMainExecutable()`, right. 
And the Driver c'tor is setting both `Driver::Dir` and `Driver::InstalledDir` based on the path of the clang executable.

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

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


More information about the cfe-commits mailing list