Absolute path information for virtual files were missing even if we
have already stat'd the files. This patch puts that information for virtual
files that can succesffully be stat'd.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
include/clang/Basic/FileManager.h | ||
---|---|---|
181 | The FIXME inside the function suggests we might change the name or semantics of RealPathName, so maybe simply refer to the field by name and avoid mentioning the semantics of the function. | |
unittests/Basic/FileManagerTest.cpp | ||
237 | This test seems to rely on the old behavior. Is there a way to test the file wasn't open other than looking at RealPathName? | |
238 | Should we fill-in the RealPathName in that case as well? | |
253 | We should find a way to test file was not "opened" (I think it actually does stat the file now, right?) | |
323 | After a check EXPECT_EQ(file1, file2), this is clearly true. |
unittests/Basic/FileManagerTest.cpp | ||
---|---|---|
237 | There is also the vfs::file stored inside the FileEntry but unfortunately there are no getters exposing this one. But I believe this behavior is still correct for the getFile case, since RealPathName will only be filled when we open the file. | |
238 | I don't think so, since we need the vfs::file to query the real path, I believe it is still ok to leave them empty for real files that hasn't been opened yet. IIUC, stating and opening are very similar in nature(from the perspective of FileManager), the only difference is there is no deferred stating for virtual files therefore it is like a normal file that will always be opened. | |
253 | AFAIK, any file accessed through getVirtualFile is immediately opened, then later on accessing a file with the same name through getFile with openfile=false won't have any affect, since this file will be alive and marked as opened in the cache. So I believe opening and stating is dual of each other. Therefore checking for one should be equivalent to check for other. |
LGTM and a few nits
include/clang/Basic/FileManager.h | ||
---|---|---|
108 | s/arther/rather | |
182 | We never use the returned value. Maybe drop it? | |
unittests/Basic/FileManagerTest.cpp | ||
237 | Using vfs::File LG, thanks! | |
253 | I'm not sure about the semantics either, it seems we need to stat anyway, maybe open referes to reading the file contents in this case? |
s/arther/rather
Let's leave out the RealPathName part, it seemed to be there for historical reasons.