Author: Serge Pavlov Date: 2021-02-26T19:02:54+07:00 New Revision: 04c3071c16d799a4406c1742f239e8381c00b2b8
URL: https://github.com/llvm/llvm-project/commit/04c3071c16d799a4406c1742f239e8381c00b2b8 DIFF: https://github.com/llvm/llvm-project/commit/04c3071c16d799a4406c1742f239e8381c00b2b8.diff LOG: [Driver] Flush file in locked area When writing report file by option -proc-stat-report some part of output can be written to unlocked file because destructor of raw_fd_ostream calls `flush()`. In high thread contention environment it can result in file operation failure. With this change `flush` is called explicitly when file is locked, so call of `flush()` in the destructor does not cause write to file. Added: Modified: clang/lib/Driver/Driver.cpp Removed: ################################################################################ diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 5aa0011d80ef..84bee2ae9d07 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -4069,6 +4069,7 @@ void Driver::BuildJobs(Compilation &C) const { return; } OS << Buffer; + OS.flush(); } }); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits