diff options
Diffstat (limited to 'clang-tools-extra/clang-doc/BitcodeReader.h')
-rw-r--r-- | clang-tools-extra/clang-doc/BitcodeReader.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/clang-tools-extra/clang-doc/BitcodeReader.h b/clang-tools-extra/clang-doc/BitcodeReader.h index aaf25257c85..ec3f6b0fd0e 100644 --- a/clang-tools-extra/clang-doc/BitcodeReader.h +++ b/clang-tools-extra/clang-doc/BitcodeReader.h @@ -22,6 +22,7 @@ #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/Support/Error.h" namespace clang { namespace doc { @@ -38,30 +39,31 @@ private: enum class Cursor { BadBlock = 1, Record, BlockEnd, BlockBegin }; // Top level parsing - bool validateStream(); - bool readVersion(); - bool readBlockInfoBlock(); + llvm::Error validateStream(); + llvm::Error readVersion(); + llvm::Error readBlockInfoBlock(); // Read a block of records into a single Info struct, calls readRecord on each // record found. - template <typename T> bool readBlock(unsigned ID, T I); + template <typename T> llvm::Error readBlock(unsigned ID, T I); // Step through a block of records to find the next data field. - template <typename T> bool readSubBlock(unsigned ID, T I); + template <typename T> llvm::Error readSubBlock(unsigned ID, T I); // Read record data into the given Info data field, calling the appropriate // parseRecord functions to parse and store the data. - template <typename T> bool readRecord(unsigned ID, T I); + template <typename T> llvm::Error readRecord(unsigned ID, T I); // Allocate the relevant type of info and add read data to the object. - template <typename T> std::unique_ptr<Info> createInfo(unsigned ID); + template <typename T> + llvm::Expected<std::unique_ptr<Info>> createInfo(unsigned ID); // Helper function to step through blocks to find and dispatch the next record // or block to be read. Cursor skipUntilRecordOrBlock(unsigned &BlockOrRecordID); // Helper function to set up the approriate type of Info. - std::unique_ptr<Info> readBlockToInfo(unsigned ID); + llvm::Expected<std::unique_ptr<Info>> readBlockToInfo(unsigned ID); llvm::BitstreamCursor &Stream; Optional<llvm::BitstreamBlockInfo> BlockInfo; |