[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
Wed May 11 11:26:09 PDT 2016


eric_niebler added a comment.

> Can you split the functionality that gets the RealPath into a new function (something like llvm::sys::fs::canonical() or llvm::sys::fs::realpath()) and make openFileForRead calls it?

>  [...]

>  This is going to be useful for a bunch of other client in clang that are now obtaining realpath in a adhoc/slow ways.


I hesitate to do that. The code in `openFileForRead` is less reusable than it appears. It prefers speed over correctness since opening files for reading is a hot path. If we make it a separate dedicated API, clients will have a reasonable expectation that it returns the correct results. Making it correct necessarily means making it slow, which means it would no longer be useable in `openFileForRead`.


http://reviews.llvm.org/D19842





More information about the llvm-commits mailing list