diff options
author | Zachary Turner <zturner@google.com> | 2018-09-21 22:36:04 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2018-09-21 22:36:04 +0000 |
commit | 355ffb0032182e74f64349dc7e4b941147bac2a2 (patch) | |
tree | 94e7412254a486f98b5faf0ee6e0c8ae58ead533 /llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp | |
parent | 10febb0779ec74ed9090bcc11667567910a807d5 (diff) | |
download | bcm5719-llvm-355ffb0032182e74f64349dc7e4b941147bac2a2.tar.gz bcm5719-llvm-355ffb0032182e74f64349dc7e4b941147bac2a2.zip |
[PDB] Add native reading support for UDT / class types.
This allows the native reader to find records of class/struct/
union type and dump them. This behavior is tested by using the
diadump subcommand against golden output produced by actual DIA
SDK on the same PDB file, and again using pretty -native to
confirm that we actually dump the classes. We don't find class
members or anything like that yet, for now it's just the class
itself.
llvm-svn: 342779
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp index 311c3859acf..96221f7d6ec 100644 --- a/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/TpiStream.cpp @@ -11,9 +11,8 @@ #include "llvm/ADT/iterator_range.h" #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h" -#include "llvm/DebugInfo/CodeView/TypeDeserializer.h" -#include "llvm/DebugInfo/CodeView/TypeIndexDiscovery.h" #include "llvm/DebugInfo/CodeView/TypeRecord.h" +#include "llvm/DebugInfo/CodeView/TypeRecordHelpers.h" #include "llvm/DebugInfo/MSF/MappedBlockStream.h" #include "llvm/DebugInfo/PDB/Native/Hash.h" #include "llvm/DebugInfo/PDB/Native/PDBFile.h" @@ -161,35 +160,6 @@ void TpiStream::buildHashMap() { bool TpiStream::supportsTypeLookup() const { return !HashMap.empty(); } -template <typename RecordT> static ClassOptions getUdtOptions(CVType CVT) { - RecordT Record; - if (auto EC = TypeDeserializer::deserializeAs<RecordT>(CVT, Record)) { - consumeError(std::move(EC)); - return ClassOptions::None; - } - return Record.getOptions(); -} - -static bool isUdtForwardRef(CVType CVT) { - ClassOptions UdtOptions = ClassOptions::None; - switch (CVT.kind()) { - case LF_STRUCTURE: - case LF_CLASS: - case LF_INTERFACE: - UdtOptions = getUdtOptions<ClassRecord>(std::move(CVT)); - break; - case LF_ENUM: - UdtOptions = getUdtOptions<EnumRecord>(std::move(CVT)); - break; - case LF_UNION: - UdtOptions = getUdtOptions<UnionRecord>(std::move(CVT)); - break; - default: - return false; - } - return (UdtOptions & ClassOptions::ForwardReference) != ClassOptions::None; -} - Expected<TypeIndex> TpiStream::findFullDeclForForwardRef(TypeIndex ForwardRefTI) const { CVType F = Types->getType(ForwardRefTI); |