summaryrefslogtreecommitdiff
path: root/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-11-08 04:17:11 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-11-08 04:17:11 +0000
commitcf26f429e818a308251ca9a54b88394e98642ccd (patch)
treefd5cbe8be973a01704700986e2d59e1f2f1c5a3a /lib/CodeGen/ObjectFilePCHContainerOperations.cpp
parent97054171ba329891fa63df9b61414b60076b3142 (diff)
downloadclang-cf26f429e818a308251ca9a54b88394e98642ccd.tar.gz
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<uint8_t>, so remove it and replace all uses with direct uses of memory buffers. Differential Revision: https://reviews.llvm.org/D26259 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286207 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
-rw-r--r--lib/CodeGen/ObjectFilePCHContainerOperations.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
index 42a9782219..baf7811eed 100644
--- a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
@@ -312,8 +312,9 @@ ObjectFilePCHContainerWriter::CreatePCHContainerGenerator(
CI, MainFileName, OutputFileName, std::move(OS), Buffer);
}
-void ObjectFilePCHContainerReader::ExtractPCH(
- llvm::MemoryBufferRef Buffer, llvm::BitstreamReader &StreamFile) const {
+StringRef
+ObjectFilePCHContainerReader::ExtractPCH(llvm::MemoryBufferRef Buffer) const {
+ StringRef PCH;
auto OFOrErr = llvm::object::ObjectFile::createObjectFile(Buffer);
if (OFOrErr) {
auto &OF = OFOrErr.get();
@@ -323,10 +324,8 @@ void ObjectFilePCHContainerReader::ExtractPCH(
StringRef Name;
Section.getName(Name);
if ((!IsCOFF && Name == "__clangast") || (IsCOFF && Name == "clangast")) {
- StringRef Buf;
- Section.getContents(Buf);
- StreamFile = llvm::BitstreamReader(Buf);
- return;
+ Section.getContents(PCH);
+ return PCH;
}
}
}
@@ -334,8 +333,9 @@ void ObjectFilePCHContainerReader::ExtractPCH(
if (EIB.convertToErrorCode() ==
llvm::object::object_error::invalid_file_type)
// As a fallback, treat the buffer as a raw AST.
- StreamFile = llvm::BitstreamReader(Buffer);
+ PCH = Buffer.getBuffer();
else
EIB.log(llvm::errs());
});
+ return PCH;
}