Skip to content

Rename F_no_mmap to F_mmap #134787

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

Merged
merged 2 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lld/ELF/Arch/ARM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ template <typename ELFT> void elf::writeARMCmseImportLib(Ctx &ctx) {
const uint64_t fileSize =
sectionHeaderOff + shnum * sizeof(typename ELFT::Shdr);
const unsigned flags =
ctx.arg.mmapOutputFile ? 0 : (unsigned)FileOutputBuffer::F_no_mmap;
ctx.arg.mmapOutputFile ? (unsigned)FileOutputBuffer::F_mmap : 0;
unlinkAsync(ctx.arg.cmseOutputLib);
Expected<std::unique_ptr<FileOutputBuffer>> bufferOrErr =
FileOutputBuffer::create(ctx.arg.cmseOutputLib, fileSize, flags);
Expand Down
4 changes: 2 additions & 2 deletions lld/ELF/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2902,8 +2902,8 @@ template <class ELFT> void Writer<ELFT>::openFile() {
unsigned flags = 0;
if (!ctx.arg.relocatable)
flags |= FileOutputBuffer::F_executable;
if (!ctx.arg.mmapOutputFile)
flags |= FileOutputBuffer::F_no_mmap;
if (ctx.arg.mmapOutputFile)
flags |= FileOutputBuffer::F_mmap;
Expected<std::unique_ptr<FileOutputBuffer>> bufferOrErr =
FileOutputBuffer::create(ctx.arg.outputFile, fileSize, flags);

Expand Down
5 changes: 2 additions & 3 deletions llvm/include/llvm/Support/FileOutputBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ class FileOutputBuffer {
/// Set the 'x' bit on the resulting file.
F_executable = 1,

/// Don't use mmap and instead write an in-memory buffer to a file when this
/// buffer is closed.
F_no_mmap = 2,
/// Use mmap for in-memory file buffer.
F_mmap = 2,
};

/// Factory method to create an OutputBuffer object which manages a read/write
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Support/FileOutputBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ FileOutputBuffer::create(StringRef Path, size_t Size, unsigned Flags) {
case fs::file_type::regular_file:
case fs::file_type::file_not_found:
case fs::file_type::status_error:
if (Flags & F_no_mmap)
if (Flags & F_mmap)
return createInMemoryBuffer(Path, Size, Mode);
else
return createOnDiskBuffer(Path, Size, Mode);
Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/Support/FileOutputBufferTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ TEST(FileOutputBuffer, Test) {
File5.append("/file5");
{
Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
FileOutputBuffer::create(File5, 8000, FileOutputBuffer::F_no_mmap);
FileOutputBuffer::create(File5, 8000, FileOutputBuffer::F_mmap);
ASSERT_NO_ERROR(errorToErrorCode(BufferOrErr.takeError()));
std::unique_ptr<FileOutputBuffer> &Buffer = *BufferOrErr;
// Start buffer with special header.
Expand Down
Loading