From b96181c2bf1d068824c6fd635c0921d0ffd20187 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Mon, 22 Oct 2018 16:19:07 +0000 Subject: Some cleanups to the native pdb plugin [NFC]. This is mostly some cleanup done in the process of implementing some basic support for types. I tried to split up the patch a bit to get some of the NFC portion of the patch out into a separate commit, and this is the result of that. It moves some code around, deletes some spurious namespace qualifications, removes some unnecessary header includes, forward declarations, etc. llvm-svn: 344913 --- llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp') diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp index 96221f7d6ec..44781705bfa 100644 --- a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp @@ -11,6 +11,7 @@ #include "llvm/ADT/iterator_range.h" #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h" +#include "llvm/DebugInfo/CodeView/RecordName.h" #include "llvm/DebugInfo/CodeView/TypeRecord.h" #include "llvm/DebugInfo/CodeView/TypeRecordHelpers.h" #include "llvm/DebugInfo/MSF/MappedBlockStream.h" @@ -158,6 +159,20 @@ void TpiStream::buildHashMap() { } } +std::vector TpiStream::findRecordsByName(StringRef Name) const { + uint32_t Bucket = hashStringV1(Name) % Header->NumHashBuckets; + if (Bucket > HashMap.size()) + return {}; + + std::vector Result; + for (TypeIndex TI : HashMap[Bucket]) { + std::string ThisName = computeTypeName(*Types, TI); + if (ThisName == Name) + Result.push_back(TI); + } + return Result; +} + bool TpiStream::supportsTypeLookup() const { return !HashMap.empty(); } Expected @@ -199,6 +214,10 @@ TpiStream::findFullDeclForForwardRef(TypeIndex ForwardRefTI) const { return ForwardRefTI; } +codeview::CVType TpiStream::getType(codeview::TypeIndex Index) { + return Types->getType(Index); +} + BinarySubstreamRef TpiStream::getTypeRecordsSubstream() const { return TypeRecordsSubstream; } -- cgit v1.2.3