diff options
Diffstat (limited to 'lib/DebugInfo/PDB/Native/TpiStream.cpp')
-rw-r--r-- | lib/DebugInfo/PDB/Native/TpiStream.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/DebugInfo/PDB/Native/TpiStream.cpp b/lib/DebugInfo/PDB/Native/TpiStream.cpp index f234d446e6a0..8ee7f897b8bb 100644 --- a/lib/DebugInfo/PDB/Native/TpiStream.cpp +++ b/lib/DebugInfo/PDB/Native/TpiStream.cpp @@ -1,9 +1,8 @@ //===- TpiStream.cpp - PDB Type Info (TPI) Stream 2 Access ----------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -79,14 +78,13 @@ Error TpiStream::reload() { // Hash indices, hash values, etc come from the hash stream. if (Header->HashStreamIndex != kInvalidStreamIndex) { - if (Header->HashStreamIndex >= Pdb.getNumStreams()) + auto HS = Pdb.safelyCreateIndexedStream(Header->HashStreamIndex); + if (!HS) { + consumeError(HS.takeError()); return make_error<RawError>(raw_error_code::corrupt_file, "Invalid TPI hash stream index."); - - auto HS = MappedBlockStream::createIndexedStream( - Pdb.getMsfLayout(), Pdb.getMsfBuffer(), Header->HashStreamIndex, - Pdb.getAllocator()); - BinaryStreamReader HSR(*HS); + } + BinaryStreamReader HSR(**HS); // There should be a hash value for every type record, or no hashes at all. uint32_t NumHashValues = @@ -111,7 +109,7 @@ Error TpiStream::reload() { return EC; } - HashStream = std::move(HS); + HashStream = std::move(*HS); } Types = llvm::make_unique<LazyRandomTypeCollection>( |