[Support] Resolve symlinks in getMainExecutable() on Windows (#76304)

This makes the Windows implementation for `getMainExecutable()` behave
the same as its Linux counterpart, in regards to symlinks. Previously,
when using `cmake ... -DLLVM_USE_SYMLINKS=ON`, calling this function
wouldn't resolve to the "real", non-symlinked path.
This commit is contained in:
Alexandre Ganea
2023-12-26 15:33:42 +00:00
committed by GitHub
parent aca3727e97
commit f11b056c02

View File

@@ -154,7 +154,10 @@ std::string getMainExecutable(const char *argv0, void *MainExecAddr) {
return "";
llvm::sys::path::make_preferred(PathNameUTF8);
return std::string(PathNameUTF8.data());
SmallString<256> RealPath;
sys::fs::real_path(PathNameUTF8, RealPath);
return std::string(RealPath);
}
UniqueID file_status::getUniqueID() const {