summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-10-22 16:19:07 +0000
committerZachary Turner <zturner@google.com>2018-10-22 16:19:07 +0000
commitb96181c2bf1d068824c6fd635c0921d0ffd20187 (patch)
treefe7122472f44f7254854fe0e170d50d14ecf3569 /llvm/lib
parent0b70a87480eae19dd34fe7c320545be260cc0364 (diff)
downloadbcm5719-llvm-b96181c2bf1d068824c6fd635c0921d0ffd20187.tar.gz
bcm5719-llvm-b96181c2bf1d068824c6fd635c0921d0ffd20187.zip
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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp19
1 files changed, 19 insertions, 0 deletions
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<TypeIndex> TpiStream::findRecordsByName(StringRef Name) const {
+ uint32_t Bucket = hashStringV1(Name) % Header->NumHashBuckets;
+ if (Bucket > HashMap.size())
+ return {};
+
+ std::vector<TypeIndex> 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<TypeIndex>
@@ -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;
}
OpenPOWER on IntegriCloud