[flang-commits] [flang] [flang] Fix extra "./" prefix in source file paths (PR #186212)
Caroline Newcombe via flang-commits
flang-commits at lists.llvm.org
Sun Mar 15 19:09:10 PDT 2026
================
@@ -63,9 +63,21 @@ std::optional<std::string> LocateSourceFile(
if (name == "-" || llvm::sys::path::is_absolute(name)) {
return name;
}
+ // Check if file exists at original path to preserve user's format.
+ bool isDir{false};
+ const auto er = llvm::sys::fs::is_directory(name, isDir);
+ if (!er && !isDir) {
+ return name;
+ }
+ // Normalize: strip leading "./" to avoid "././file" with "." search paths.
+ llvm::StringRef nameRef(name);
+ if (nameRef.starts_with("./")) {
----------------
cenewcombe wrote:
The new commit avoids matching on `/`
https://github.com/llvm/llvm-project/pull/186212
More information about the flang-commits
mailing list