class C13RawVisitor : public DebugSubsectionVisitor {
public:
C13RawVisitor(ScopedPrinter &P, LazyRandomTypeCollection &TPI,
- LazyRandomTypeCollection &IPI)
+ LazyRandomTypeCollection *IPI)
: P(P), TPI(TPI), IPI(IPI) {}
Error visitUnknown(DebugUnknownSubsectionRef &Unknown) override {
private:
Error dumpTypeRecord(StringRef Label, TypeIndex Index) {
- CompactTypeDumpVisitor CTDV(IPI, Index, &P);
- DictScope D(P, Label);
- if (IPI.contains(Index)) {
- CVType Type = IPI.getType(Index);
- if (auto EC = codeview::visitTypeRecord(Type, CTDV))
- return EC;
- } else {
+ bool Success = false;
+ if (IPI) {
+ CompactTypeDumpVisitor CTDV(*IPI, Index, &P);
+ DictScope D(P, Label);
+ if (IPI->contains(Index)) {
+ CVType Type = IPI->getType(Index);
+ if (auto EC = codeview::visitTypeRecord(Type, CTDV))
+ return EC;
+ }
+ }
+
+ if (!Success) {
P.printString(
llvm::formatv("Index: {0:x} (unknown function)", Index.getIndex())
.str());
ScopedPrinter &P;
LazyRandomTypeCollection &TPI;
- LazyRandomTypeCollection &IPI;
+ LazyRandomTypeCollection *IPI;
};
}
return Error::success();
}
+ ExitOnError Err("Error while processing DBI Stream");
+
auto DS = File.getPDBDbiStream();
if (!DS)
return DS.takeError();
}
if (!opts::shared::DumpModuleSubsections.empty()) {
ListScope SS(P, "Subsections");
- auto ExpectedIpi = initializeTypeDatabase(StreamIPI);
- if (!ExpectedIpi)
- return ExpectedIpi.takeError();
- auto &Ipi = *ExpectedIpi;
+ auto &InfoS = Err(File.getPDBInfoStream());
+ LazyRandomTypeCollection *Ipi = nullptr;
+ if (InfoS.containsIdStream())
+ Ipi = &Err(initializeTypeDatabase(StreamIPI));
auto ExpectedStrings = File.getStringTable();
if (!ExpectedStrings)
return joinErrors(