[llvm] 1e43cab - [FileCollector] Lock Mutex in copyFiles
Jan Korous via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 28 11:08:20 PDT 2020
Author: Jan Korous
Date: 2020-04-28T11:08:04-07:00
New Revision: 1e43cab3c6724b2f9089a0a2b42e8dfdfdd1a299
URL: https://github.com/llvm/llvm-project/commit/1e43cab3c6724b2f9089a0a2b42e8dfdfdd1a299
DIFF: https://github.com/llvm/llvm-project/commit/1e43cab3c6724b2f9089a0a2b42e8dfdfdd1a299.diff
LOG: [FileCollector] Lock Mutex in copyFiles
We should synchronize reading of VFSWriter's data with the rest of the methods.
Differential revision: https://reviews.llvm.org/D78956
Added:
Modified:
llvm/include/llvm/Support/FileCollector.h
llvm/lib/Support/FileCollector.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/FileCollector.h b/llvm/include/llvm/Support/FileCollector.h
index 1b6383ef8cc2..3a8741c88633 100644
--- a/llvm/include/llvm/Support/FileCollector.h
+++ b/llvm/include/llvm/Support/FileCollector.h
@@ -69,7 +69,7 @@ class FileCollector {
addDirectoryImpl(const llvm::Twine &Dir,
IntrusiveRefCntPtr<vfs::FileSystem> FS, std::error_code &EC);
- /// Synchronizes adding files.
+ /// Synchronizes access to Seen, VFSWriter and SymlinkMap.
std::mutex Mutex;
/// The root directory where files are copied.
diff --git a/llvm/lib/Support/FileCollector.cpp b/llvm/lib/Support/FileCollector.cpp
index f6d72685a8c3..e13a7b5c233d 100644
--- a/llvm/lib/Support/FileCollector.cpp
+++ b/llvm/lib/Support/FileCollector.cpp
@@ -150,6 +150,8 @@ copyAccessAndModificationTime(StringRef Filename,
}
std::error_code FileCollector::copyFiles(bool StopOnError) {
+ std::lock_guard<std::mutex> lock(Mutex);
+
for (auto &entry : VFSWriter.getMappings()) {
// Create directory tree.
if (std::error_code EC =
More information about the llvm-commits
mailing list