[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 authored and GitHub committed 2023-12-26 10:33:42 -05:00
1 parent aca3727e97
commit f11b056c02
1 file changed
+4 -1
+4 -1
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 {