[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:07:05 PDT 2026
cenewcombe wrote:
> Why is LocateSourceFile being passed a file name with `./` already prepended to it even if that was not what the user typed in? Should we be looking to fix this higher up in the call chain?
Sorry, my original solution made this issue seem more convoluted than it is. The `.` is added to the search path by an earlier call, but the issue is that LocateSourceFile appends the file name to the search path. When the search directory is `.`, this results in `./filename` or `././filename`. The result always has one more `./` than what the user passed in.
A better solution is to skip the append when the search path is `.` and just use the file name. In all other cases, we still need to append. (And we do need `.` in the search path.) My original fix didn't really make sense, as we don't need to strip anything out -- just skip the append. I've pushed a new commit that is more straightforward.
https://github.com/llvm/llvm-project/pull/186212
More information about the flang-commits
mailing list