aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ModuleManager.cpp
diff options
context:
space:
mode:
authorMichael Spencer <bigcheesegs@gmail.com>2020-06-10 14:37:03 -0600
committerMichael Spencer <bigcheesegs@gmail.com>2020-06-10 14:37:30 -0600
commit1727c6aab34012f0cefc8a3f29ede5f1f718c832 (patch)
treea04f4624afa81504b0257dc12f57dcec906d57e5 /clang/lib/Serialization/ModuleManager.cpp
parent4e813bbdf335626a741398314709a535ef52fe8e (diff)
downloadllvm-1727c6aab34012f0cefc8a3f29ede5f1f718c832.zip
llvm-1727c6aab34012f0cefc8a3f29ede5f1f718c832.tar.gz
llvm-1727c6aab34012f0cefc8a3f29ede5f1f718c832.tar.bz2
[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.
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r--clang/lib/Serialization/ModuleManager.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp
index 2656220..a42ed2f 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) {