Author: Michael Spencer Date: 2020-06-10T14:37:30-06:00 New Revision: 1727c6aab34012f0cefc8a3f29ede5f1f718c832
URL: https://github.com/llvm/llvm-project/commit/1727c6aab34012f0cefc8a3f29ede5f1f718c832 DIFF: https://github.com/llvm/llvm-project/commit/1727c6aab34012f0cefc8a3f29ede5f1f718c832.diff LOG: [clang] Use IsVolatile=true and RequiresNullTerminator=false for PCMs This change got missed while upstreaming https://reviews.llvm.org/D77772. This is the part of that change that actually passes the correct arguments when opening a PCM. The test didn't catch this because it starts at the `MemoryBuffer::getOpenFile` level. It's not really possible to test `ModuleManager::addModule` itself to verify how the file was opened. Added: Modified: clang/lib/Serialization/ModuleManager.cpp Removed: ################################################################################ diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 2656220f306d..a42ed2f3c179 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -185,7 +185,14 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, Buf = llvm::MemoryBuffer::getSTDIN(); } else { // Get a buffer of the file and close the file descriptor when done. - Buf = FileMgr.getBufferForFile(NewModule->File, /*isVolatile=*/false); + // The file is volatile because in a parallel build we expect multiple + // compiler processes to use the same module file rebuilding it if needed. + // + // RequiresNullTerminator is false because module files don't need it, and + // this allows the file to still be mmapped. + Buf = FileMgr.getBufferForFile(NewModule->File, + /*IsVolatile=*/true, + /*RequiresNullTerminator=*/false); } if (!Buf) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits