[PATCH] D64116: [llvm-bcanalyzer] Refactor and move to libLLVMBitReader
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 3 15:25:37 PDT 2019
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.
LGTM, with one minor nit inline. Thanks for doing this, Francis!
================
Comment at: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:73
// Read the input file.
- ErrorOr<std::unique_ptr<MemoryBuffer>> MemBufOrErr =
- MemoryBuffer::getFileOrSTDIN(Path);
- if (std::error_code EC = MemBufOrErr.getError())
- return ReportError(Twine("ReportError reading '") + Path + "': " + EC.message());
- MemBuf = std::move(MemBufOrErr.get());
-
- if (MemBuf->getBufferSize() & 3)
- return ReportError("Bitcode stream should be a multiple of 4 bytes in length");
-
- const unsigned char *BufPtr = (const unsigned char *)MemBuf->getBufferStart();
- const unsigned char *EndBufPtr = BufPtr + MemBuf->getBufferSize();
+ Expected<std::unique_ptr<MemoryBuffer>> memBufOrErr =
+ errorOrToExpected(MemoryBuffer::getFileOrSTDIN(Path));
----------------
s/memBufOrErr/MemBufOrErr/
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64116/new/
https://reviews.llvm.org/D64116
More information about the llvm-commits
mailing list