[PATCH] D112297: [LTO] Fix assertion failed when flushing bitcode incrementally for LTO output.

Xu Mingjie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 1 20:00:14 PDT 2021


Enna1 added a comment.

Thanks for your review @steven_wu @dexonsmith

What about add a `bool IsRegularField` field like `bool SupportsSeeking` in raw_fd_ostream, and change the code around here <https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/raw_ostream.cpp#L646-L653> like this:

    // Get the starting position.
    off_t loc = ::lseek(FD, 0, SEEK_CUR);
    sys::fs::file_status Status;
    std::error_code EC = status(FD, Status);
    IsRegularFile = Status.type() == sys::fs::file_type::regular_file;
  #ifdef _WIN32
    // MSVCRT's _lseek(SEEK_CUR) doesn't return -1 for pipes.
    SupportsSeeking = !EC && IsRegularFile;
  #else
    SupportsSeeking = loc != (off_t)-1;
  #endif

So we can directly use `IsRegularFile ` in raw_fd_stream constructor.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112297/new/

https://reviews.llvm.org/D112297



More information about the llvm-commits mailing list