aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/GlobalModuleIndex.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-02-06 18:08:37 +0000
committerDouglas Gregor <dgregor@apple.com>2013-02-06 18:08:37 +0000
commitcb680661eb84cb0b034a55678a3445aede52bf8c (patch)
tree204b5cb01015d676f23f9b8ee54ca9ec66e6a227 /clang/lib/Serialization/GlobalModuleIndex.cpp
parent5178942dedde6560316d52699742694e4495ea62 (diff)
downloadllvm-cb680661eb84cb0b034a55678a3445aede52bf8c.zip
llvm-cb680661eb84cb0b034a55678a3445aede52bf8c.tar.gz
llvm-cb680661eb84cb0b034a55678a3445aede52bf8c.tar.bz2
Eliminate a race condition with the global module index.
Essentially, a module file on disk could change size between the time we stat() it and the time we open it, and we need to be robust against such a problem. llvm-svn: 174529
Diffstat (limited to 'clang/lib/Serialization/GlobalModuleIndex.cpp')
-rw-r--r--clang/lib/Serialization/GlobalModuleIndex.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp
index 72165bc..5b2ab91 100644
--- a/clang/lib/Serialization/GlobalModuleIndex.cpp
+++ b/clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -536,7 +536,8 @@ namespace {
bool GlobalModuleIndexBuilder::loadModuleFile(const FileEntry *File) {
// Open the module file.
OwningPtr<llvm::MemoryBuffer> Buffer;
- Buffer.reset(FileMgr.getBufferForFile(File));
+ std::string ErrorStr;
+ Buffer.reset(FileMgr.getBufferForFile(File, &ErrorStr, /*isVolatile=*/true));
if (!Buffer) {
return true;
}