diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp | 14 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeDumper.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp | 5 |
4 files changed, 20 insertions, 12 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp b/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp index 18215d35582..b4c3a9f4c21 100644 --- a/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp +++ b/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp @@ -75,10 +75,13 @@ static Error visitKnownRecord(const CVRecord<TypeLeafKind> &Record, } Error CVTypeVisitor::visitTypeRecord(const CVRecord<TypeLeafKind> &Record) { - if (auto EC = Callbacks.visitTypeBegin(Record)) - return EC; + TypeLeafKind Kind; + if (auto ExpectedKind = Callbacks.visitTypeBegin(Record)) + Kind = *ExpectedKind; + else + return ExpectedKind.takeError(); - switch (Record.Type) { + switch (Kind) { default: if (auto EC = Callbacks.visitUnknownType(Record)) return EC; @@ -133,8 +136,9 @@ Error CVTypeVisitor::visitFieldListMemberStream(ArrayRef<uint8_t> Data) { if (!ExpectedRecord) \ return ExpectedRecord.takeError(); \ auto &Record = *ExpectedRecord; \ - if (auto EC = Callbacks.visitTypeBegin(Record)) \ - return EC; \ + auto ExpectedKind = Callbacks.visitTypeBegin(Record); \ + if (!ExpectedKind || *ExpectedKind != Leaf) \ + return ExpectedKind.takeError(); \ if (auto EC = visitKnownRecord<Name##Record>(Record, Callbacks)) \ return EC; \ if (auto EC = Callbacks.visitTypeEnd(Record)) \ diff --git a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp index f7dfdd2f398..43e29b7f451 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp @@ -203,7 +203,8 @@ static StringRef getLeafTypeName(TypeLeafKind LT) { return "UnknownLeaf"; } -Error CVTypeDumper::visitTypeBegin(const CVRecord<TypeLeafKind> &Record) { +Expected<TypeLeafKind> +CVTypeDumper::visitTypeBegin(const CVRecord<TypeLeafKind> &Record) { // Reset Name to the empty string. If the visitor sets it, we know it. Name = ""; @@ -223,7 +224,7 @@ Error CVTypeDumper::visitTypeBegin(const CVRecord<TypeLeafKind> &Record) { assert(!IsInFieldList); IsInFieldList = true; } - return Error::success(); + return Record.Type; } Error CVTypeDumper::visitTypeEnd(const CVRecord<TypeLeafKind> &Record) { diff --git a/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp b/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp index ddc3f4af58e..f2a7298a8d1 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp @@ -70,7 +70,8 @@ public: Error visitUnknownType(const CVRecord<TypeLeafKind> &Record) override; - Error visitTypeBegin(const CVRecord<TypeLeafKind> &Record) override; + Expected<TypeLeafKind> + visitTypeBegin(const CVRecord<TypeLeafKind> &Record) override; Error visitTypeEnd(const CVRecord<TypeLeafKind> &Record) override; bool mergeStream(const CVTypeArray &Types); @@ -123,13 +124,14 @@ private: } // end anonymous namespace -Error TypeStreamMerger::visitTypeBegin(const CVRecord<TypeLeafKind> &Rec) { +Expected<TypeLeafKind> +TypeStreamMerger::visitTypeBegin(const CVRecord<TypeLeafKind> &Rec) { if (Rec.Type == TypeLeafKind::LF_FIELDLIST) { assert(!IsInFieldList); IsInFieldList = true; } else BeginIndexMapSize = IndexMap.size(); - return Error::success(); + return Rec.Type; } Error TypeStreamMerger::visitTypeEnd(const CVRecord<TypeLeafKind> &Rec) { diff --git a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp index 74200e70119..7154b297b12 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/TpiStream.cpp @@ -121,10 +121,11 @@ public: return verify(Rec); } - Error visitTypeBegin(const CVRecord<TypeLeafKind> &Rec) override { + Expected<TypeLeafKind> + visitTypeBegin(const CVRecord<TypeLeafKind> &Rec) override { ++Index; RawRecord = &Rec; - return Error::success(); + return Rec.Type; } private: |