summaryrefslogtreecommitdiffstats
path: root/llvm
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
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')
-rw-r--r--llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h4
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h4
-rw-r--r--llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp19
3 files changed, 27 insertions, 0 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
index 9a06a6a3344..76f1f98ab66 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -429,6 +429,10 @@ public:
return (Options & ClassOptions::ForwardReference) != ClassOptions::None;
}
+ bool isScoped() const {
+ return (Options & ClassOptions::Scoped) != ClassOptions::None;
+ }
+
uint16_t getMemberCount() const { return MemberCount; }
ClassOptions getOptions() const { return Options; }
TypeIndex getFieldList() const { return FieldList; }
diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h b/llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h
index 00cc720336c..b76576a7a26 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/TpiStream.h
@@ -61,6 +61,10 @@ public:
Expected<codeview::TypeIndex>
findFullDeclForForwardRef(codeview::TypeIndex ForwardRefTI) const;
+ std::vector<codeview::TypeIndex> findRecordsByName(StringRef Name) const;
+
+ codeview::CVType getType(codeview::TypeIndex Index);
+
BinarySubstreamRef getTypeRecordsSubstream() const;
Error commit();
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