Index: llvm/include/llvm/Support/FileCollector.h =================================================================== --- llvm/include/llvm/Support/FileCollector.h +++ llvm/include/llvm/Support/FileCollector.h @@ -59,6 +59,7 @@ } protected: + /// FIXME: Seems more like it synchronizes everything (...accessible via public interface). /// Synchronizes adding files. std::mutex Mutex; Index: llvm/lib/Support/FileCollector.cpp =================================================================== --- llvm/lib/Support/FileCollector.cpp +++ llvm/lib/Support/FileCollector.cpp @@ -123,6 +123,9 @@ } std::error_code FileCollector::copyFiles(bool StopOnError) { + // TODO: We're reading from VFSWriter so we should lock the Mutex, right? + std::lock_guard lock(Mutex); + for (auto &entry : VFSWriter.getMappings()) { // Create directory tree. if (std::error_code EC =