]> granicus.if.org Git - clang/commit
Introduce a flag in SourceManager to treat non-system source files
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 11 Jul 2012 20:59:04 +0000 (20:59 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 11 Jul 2012 20:59:04 +0000 (20:59 +0000)
commitff398965a5abfaf5bc47bc022876f56a28e5b9a7
treeae3e8d01cc8359f810150ccf2ad37075a40165c8
parent4b49756fdc066688e30f6ca69feffd5f7686cb1b
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
include/clang/Basic/FileManager.h
include/clang/Basic/SourceManager.h
include/clang/Frontend/ASTUnit.h
lib/Basic/FileManager.cpp
lib/Basic/SourceManager.cpp
lib/Frontend/ASTUnit.cpp
lib/Serialization/ASTReader.cpp
tools/libclang/CIndex.cpp
tools/libclang/Indexing.cpp