From 77c89b6958f51a0b26c4849d37a200c1bc0319df Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 8 Nov 2016 04:17:11 +0000 Subject: Bitcode: Decouple block info block state from reader. As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106630.html Move block info block state to a new class, BitstreamBlockInfo. Clients may set the block info for a particular cursor with the BitstreamCursor::setBlockInfo() method. At this point BitstreamReader is not much more than a container for an ArrayRef, so remove it and replace all uses with direct uses of memory buffers. Differential Revision: https://reviews.llvm.org/D26259 llvm-svn: 286207 --- clang/lib/Serialization/GlobalModuleIndex.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'clang/lib/Serialization/GlobalModuleIndex.cpp') diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp index e55ed40b227..9f986d54a98 100644 --- a/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -245,11 +245,8 @@ GlobalModuleIndex::readIndex(StringRef Path) { return std::make_pair(nullptr, EC_NotFound); std::unique_ptr Buffer = std::move(BufferOrErr.get()); - /// \brief The bitstream reader from which we'll read the AST file. - llvm::BitstreamReader Reader(*Buffer); - /// \brief The main bitstream cursor for the main block. - llvm::BitstreamCursor Cursor(Reader); + llvm::BitstreamCursor Cursor(*Buffer); // Sniff for the signature. if (Cursor.Read(8) != 'B' || @@ -503,9 +500,7 @@ bool GlobalModuleIndexBuilder::loadModuleFile(const FileEntry *File) { } // Initialize the input stream - llvm::BitstreamReader InStreamFile; - PCHContainerRdr.ExtractPCH((*Buffer)->getMemBufferRef(), InStreamFile); - llvm::BitstreamCursor InStream(InStreamFile); + llvm::BitstreamCursor InStream(PCHContainerRdr.ExtractPCH(**Buffer)); // Sniff for the signature. if (InStream.Read(8) != 'C' || -- cgit v1.2.3