To allow unit testing this code path, switch to using VFS instead of the real file system.
Details
Diff Detail
Event Timeline
Looks great!
| clang/lib/Driver/Driver.cpp | ||
|---|---|---|
| 5979 | Change to lower case while updating the signature. | |
Unfortunately, it looks like there are legitimate failures of flang tests on Windows in pre-merge checks, thanks to this bit of magic in the Windows implementation of can_execute: https://github.com/llvm/llvm-project/blob/f0687b47a0ce82da07127fee4fe6af801df54ca6/llvm/lib/Support/Windows/Path.inc#L643-L646 So when checking whether flang-new is executable, it will also check for flang-new.exe and we end up returning the former. Now we end up returning the latter. Not sure what to do about this.
I don't see a good way forward here. fs::can_execute has platform specific code. I don't want to replicate its logic here, and making VFS platform-dependent also seems dubious. The cleanest solution would be to make fs::can_execute itself operate on VFS, but I think this doesn't really work with the current layering. There is also a related problem that findProgramByName() isn't VFS-based either, so there remains a partial dependency on the real FS.
Change to lower case while updating the signature.