Skip to content
Snippets Groups Projects
  • Erik Verbruggen's avatar
    121956bd
    FileManager: mark virtual file entries as valid entries · 121956bd
    Erik Verbruggen authored
    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
    121956bd
    History
    FileManager: mark virtual file entries as valid entries
    Erik Verbruggen authored
    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
Code owners
Assign users and groups as approvers for specific file changes. Learn more.