diff options
author | Erik Verbruggen <erikjv@me.com> | 2017-03-28 09:18:05 +0000 |
---|---|---|
committer | Erik Verbruggen <erikjv@me.com> | 2017-03-28 09:18:05 +0000 |
commit | 121956bde3695cafabb07a61866ad2432fb31ae9 (patch) | |
tree | cc768e300f91916023d527c9cc1b8203d1a30a9c /docs/LibASTMatchersReference.html | |
parent | 0ba785f458ab9138391703e94f2c835005549e1f (diff) |
FileManager: mark virtual file entries as valid entries
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/LibASTMatchersReference.html')
0 files changed, 0 insertions, 0 deletions