[all-commits] [llvm/llvm-project] 9d53db: [Support] Allow FileOutputBuffer::create to create...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue May 5 08:12:21 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9d53db2aa098ca5136c352c38710ea48bf078e7a
      https://github.com/llvm/llvm-project/commit/9d53db2aa098ca5136c352c38710ea48bf078e7a
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-05-05 (Tue, 05 May 2020)

  Changed paths:
    M llvm/lib/Support/FileOutputBuffer.cpp
    M llvm/unittests/Support/FileOutputBufferTest.cpp

  Log Message:
  -----------
  [Support] Allow FileOutputBuffer::create to create an empty file

Size==0 triggers `assert(Size != 0)` in mapped_file_region::init.
I plan to use an empty file in D79339 (llvm-objcopy --dump-section).

According to POSIX, "If len is zero, mmap() shall fail and no mapping
shall be established." Just specialize case Size=0 to use
createInMemoryBuffer.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D79338




More information about the All-commits mailing list