diff options
author | Zachary Turner <zturner@google.com> | 2016-05-03 22:18:17 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-05-03 22:18:17 +0000 |
commit | 2d02ceefdc005bb05ae36fd3604a3810723f6cb9 (patch) | |
tree | a16a0588ea1b7e6199df4cc126e3a2206e83ca4d /llvm/lib | |
parent | 263942f59046d0e67f9d064b9f8f232cdce08467 (diff) | |
download | bcm5719-llvm-2d02ceefdc005bb05ae36fd3604a3810723f6cb9.tar.gz bcm5719-llvm-2d02ceefdc005bb05ae36fd3604a3810723f6cb9.zip |
Move CodeViewTypeStream to DebugInfo/CodeView
Ability to parse codeview type streams is also needed by
DebugInfoPDB for parsing PDBs, so moving this into a library
gives us this option. Since DebugInfoPDB had already hand
rolled some code to do this, that code is now convereted over
to using this common abstraction.
Differential Revision: http://reviews.llvm.org/D19887
Reviewed By: dblaikie, amccarth
llvm-svn: 268454
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp index 7ee4c60789b..703ae5d7183 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp @@ -88,25 +88,6 @@ std::error_code TpiStream::reload() { // The actual type records themselves come from this stream RecordsBuffer.initialize(Reader, Header->TypeRecordBytes); - TypeRecords.resize(TypeIndexEnd() - ::MinTypeIndex); - StreamReader RecordsReader(RecordsBuffer); - for (uint32_t I = TypeIndexBegin(); I < TypeIndexEnd(); ++I) { - HashedTypeRecord &Record = TypeRecords[I - ::MinTypeIndex]; - codeview::TypeRecordPrefix Prefix; - if (auto EC = RecordsReader.readObject(&Prefix)) - return EC; - - Record.Kind = - static_cast<codeview::TypeLeafKind>(static_cast<uint16_t>(Prefix.Leaf)); - - // Since we read this entire buffer into a ByteStream, we are guaranteed - // that the entire buffer is contiguous (i.e. there's no longer a chance - // that it splits across a page boundary. So we can request a reference - // directly into the stream buffer to avoid unnecessary memory copies. - uint32_t RecordSize = Prefix.Len - sizeof(Prefix.Leaf); - if (auto EC = RecordsReader.getArrayRef(Record.Record, RecordSize)) - return EC; - } // Hash indices, hash values, etc come from the hash stream. MappedBlockStream HS(Header->HashStreamIndex, Pdb); @@ -136,8 +117,6 @@ uint32_t TpiStream::NumTypeRecords() const { return TypeIndexEnd() - TypeIndexBegin(); } -ArrayRef<TpiStream::HashedTypeRecord> TpiStream::records() const { - const HashedTypeRecord *Begin = - &TypeRecords[TypeIndexBegin() - ::MinTypeIndex]; - return ArrayRef<HashedTypeRecord>(Begin, NumTypeRecords()); +iterator_range<codeview::TypeIterator> TpiStream::types() const { + return codeview::makeTypeRange(RecordsBuffer.str()); } |