Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang] Use IsVolatile=true and RequiresNullTerminator=false for PCMs #1327

Merged
merged 1 commit into from
Jun 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions clang/lib/Serialization/ModuleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,15 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type,
if (FileName == "-") {
Buf = llvm::MemoryBuffer::getSTDIN();
} else {
// Get a buffer of the file and close the file descriptor when done. Use
// IsVolatile=true since PCMs with same signature can have different sizes
// due to different content in the unhashed control block (e.g. diagnostic
// options). Tha said, concurrent creation & access of the same PCM
// filename can lead to reading past the buffer size otherwise.
Buf = FileMgr.getBufferForFile(NewModule->File, /*IsVolatile=*/true);
// Get a buffer of the file and close the file descriptor when done.
// 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) {
Expand Down