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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 06:39:04 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__)
----------------
AaronBallman wrote:

Can we use [`getMainExecutable()`](https://github.com/llvm/llvm-project/blob/1f0126902876cb42a7502047e62bdf512fd96b02/llvm/include/llvm/Support/FileSystem.h#L1345) instead?

(This sort of system-specific logic should live in LLVM's Support directory so that we don't sprinkle host-specific preprocessor conditionals all over, but better still if we can use our existing facilities rather than invent new ones.)

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


More information about the cfe-commits mailing list