forked from OSchip/llvm-project
dfffaf579f
The getVirtualFile method would create entries for e.g. libclang's CXUnsavedFile but not mark them as valid. The effect is that a lookup through getFile where the file name is not exactly matching the virtual file (e.g. through mixing slashes and backslashes on Windows) would result in a normal file "lookup", and re-using the file entry found by using the UniqueID, and overwrite the file entry fields. Because the lookup involves opening the file, and moving it into the file entry, the file is now open. The SourceManager keys its buffers on the UniqueID (which is still the same), so it will find an already loaded buffer. Because only the loading a buffer from disk will close the file, the FileEntry will hold on to an open file for as long as the FileManager is around. As the FileManager will only get destroyed at a reparse, you can't safe to the "leaked" and locked file on Windows. llvm-svn: 298905 |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
CharInfoTest.cpp | ||
DiagnosticTest.cpp | ||
FileManagerTest.cpp | ||
MemoryBufferCacheTest.cpp | ||
SourceManagerTest.cpp | ||
VirtualFileSystemTest.cpp |