The problem on windows is that both forward-slashes and back-slashes aregetVirtualFile method would create entries for e.g. libclang's
accepted as path separators. However,CXUnsavedFile but not mark them as valid. the FileManager storeThe effect is the path asat a lookup
reported by the OS after opening the file. Forthrough getFile where the file name is not example: d:\dev/foo.ccctly matching the virtual
will be stored with the key d:\dev\foo.ccfile (e.g. Subsequent lookups for thethrough mixing slashes and backslashes on Windows) would
case with the forward slash then miss that cache entryresult in a normal file "lookup", and clang endsre-using the file entry found
up doing many more file accesses than needed.
It also hadby using the UniqueID, and overwrite the nasty side-effect of not closing the filfile entry fields. Because the seconde
time it was loaded (untillookup involves opening the FileManager was destroyed):file, and moving it into the lexerfile entry, the
would create a buffer by file-id,file is now open. and the buffer cache would returThe SourceManager keys its buffers on thee UniqueID
buffer created the previous time the file was opened.(which is still the same), And becauseso it will find an already loaded buffer.
creatingBecause only the buffer also closes the file, this would not happen.loading a buffer from disk will close the file, As longthe
as the FileManager was around (i.e.FileEntry will hold on to an open file for as long as the translation unit forFileManager
e.gis around. libclang was around), and IDE couldAs the FileManager will only get destroyed at a reparse,
you can't save thatfe to the "leaked" and locked file on Windows.