This patch addresses inconsistencies in the way fallthrough is handled in the RedirectingFileSystem. Rather than trying to change the working directory of the external filesystem, the RedirectingFileSystem will canonicalize every path before handing it down. This guarantees that relative paths are resolved relative to the RedirectingFileSystem's working directory. This allows us to have a strictly virtual working directory, and still fallthrough for absolute paths, but not for relative paths that would get resolved incorrectly at the lower layer (for example, in case of the RealFileSystem, because the strictly virtual path does not exist).
Details
Diff Detail
Event Timeline
This seems like a good simplification.
llvm/lib/Support/VirtualFileSystem.cpp | ||
---|---|---|
1085–1094 | I think you need to call makeCanonical here. | |
1753–1755 | Typo s/StirngRef/StringRef/ | |
1754 | Is there a reason you had to manually inline canonicalize() here? It'd be nice to reuse the logic, since it's not entirely obvious. |
- Implement makeCanonical using canonicalize
- Add missing call to makeCanonical is isLocal
llvm/lib/Support/VirtualFileSystem.cpp | ||
---|---|---|
1754 | I was trying to avoid the copy into the SmallString, but that didn't work out because you need a buffer to copy from (otherwise you're copying from yourself). We could add an overload to remove_leading_dotslash that performs the operation in-place, but that would be for a separate patch. |
I think you need to call makeCanonical here.