[PATCH] D19842: In openFileForRead, attempt to fetch the actual name of the file on disk -- including case -- so that clang can later warn about non-portable #include and #import directives.

Eric Niebler via llvm-commits llvm-commits at lists.llvm.org
Thu May 12 16:17:27 PDT 2016


eric_niebler added a comment.

> clang has been using realpath in the FileManager for a long time and it seems to be working fine, I'm not following why it isn't 100% correct. In the VFS, as far as the needs go, it has been used to detect symlink in the components and work as expected.


Ah, we're talking about 2 different things. You want to: (a) get the absolute path(?), (b) resolve symlinks, and (c) eliminate "." and ".." components from the path. That is precisely `realpath`'s purpose. I want to get the proper case for a path. `realpath` doesn't (necessarily) do that, so I have to fart around doing platform-specific-y things that are likely to succeed. I have no data to suggest that those platform-specific-y things are better at `realpath`'s job than `realpath` is.

If I factored this code out into an API, I wouldn't call it `canonicalize` or `realpath`; I'd call it something like `try_get_real_case` or some such. Do you think something like that would be generally useful?


http://reviews.llvm.org/D19842





More information about the llvm-commits mailing list