Introduce a flag in SourceManager to treat non-system source files
as "volatile", meaning there's a high enough chance that they may change while we are trying to use them. This flag is only enabled by libclang. Currently "volatile" source files will be stat'ed immediately before opening them, because the file size stat info may not be accurate since when we got it (e.g. from the PCH). This avoids crashes when trying to reference mmap'ed memory from a file whose size is not what we expect. Note that there's still a window for a racing issue to occur but the window for it should be way smaller than before. We can consider later on to avoid mmap completely on such files. rdar://11612916 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160074 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/Basic/FileManager.h 2 additions, 1 deletioninclude/clang/Basic/FileManager.h
- include/clang/Basic/SourceManager.h 25 additions, 6 deletionsinclude/clang/Basic/SourceManager.h
- include/clang/Frontend/ASTUnit.h 12 additions, 3 deletionsinclude/clang/Frontend/ASTUnit.h
- lib/Basic/FileManager.cpp 11 additions, 5 deletionslib/Basic/FileManager.cpp
- lib/Basic/SourceManager.cpp 11 additions, 3 deletionslib/Basic/SourceManager.cpp
- lib/Frontend/ASTUnit.cpp 20 additions, 8 deletionslib/Frontend/ASTUnit.cpp
- lib/Serialization/ASTReader.cpp 5 additions, 3 deletionslib/Serialization/ASTReader.cpp
- tools/libclang/CIndex.cpp 3 additions, 1 deletiontools/libclang/CIndex.cpp
- tools/libclang/Indexing.cpp 5 additions, 2 deletionstools/libclang/Indexing.cpp
Loading
Please register or sign in to comment