18c099fe0SZachary Turner //===- DebugSubsectionVisitor.cpp ---------------------------*- C++ -*-===// 28c099fe0SZachary Turner // 38c099fe0SZachary Turner // The LLVM Compiler Infrastructure 48c099fe0SZachary Turner // 58c099fe0SZachary Turner // This file is distributed under the University of Illinois Open Source 68c099fe0SZachary Turner // License. See LICENSE.TXT for details. 78c099fe0SZachary Turner // 88c099fe0SZachary Turner //===----------------------------------------------------------------------===// 98c099fe0SZachary Turner 108c099fe0SZachary Turner #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h" 118c099fe0SZachary Turner 128c099fe0SZachary Turner #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h" 13*349c18f8SZachary Turner #include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h" 14*349c18f8SZachary Turner #include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h" 158c099fe0SZachary Turner #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h" 168c099fe0SZachary Turner #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h" 178c099fe0SZachary Turner #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h" 188c099fe0SZachary Turner #include "llvm/DebugInfo/CodeView/DebugUnknownSubsection.h" 198c099fe0SZachary Turner #include "llvm/Support/BinaryStreamReader.h" 208c099fe0SZachary Turner #include "llvm/Support/BinaryStreamRef.h" 218c099fe0SZachary Turner 228c099fe0SZachary Turner using namespace llvm; 238c099fe0SZachary Turner using namespace llvm::codeview; 248c099fe0SZachary Turner 258c099fe0SZachary Turner Error llvm::codeview::visitDebugSubsection(const DebugSubsectionRecord &R, 268c099fe0SZachary Turner DebugSubsectionVisitor &V) { 278c099fe0SZachary Turner BinaryStreamReader Reader(R.getRecordData()); 288c099fe0SZachary Turner switch (R.kind()) { 298c099fe0SZachary Turner case DebugSubsectionKind::Lines: { 308c099fe0SZachary Turner DebugLinesSubsectionRef Fragment; 318c099fe0SZachary Turner if (auto EC = Fragment.initialize(Reader)) 328c099fe0SZachary Turner return EC; 338c099fe0SZachary Turner 348c099fe0SZachary Turner return V.visitLines(Fragment); 358c099fe0SZachary Turner } 368c099fe0SZachary Turner case DebugSubsectionKind::FileChecksums: { 378c099fe0SZachary Turner DebugChecksumsSubsectionRef Fragment; 388c099fe0SZachary Turner if (auto EC = Fragment.initialize(Reader)) 398c099fe0SZachary Turner return EC; 408c099fe0SZachary Turner 418c099fe0SZachary Turner return V.visitFileChecksums(Fragment); 428c099fe0SZachary Turner } 438c099fe0SZachary Turner case DebugSubsectionKind::InlineeLines: { 448c099fe0SZachary Turner DebugInlineeLinesSubsectionRef Fragment; 458c099fe0SZachary Turner if (auto EC = Fragment.initialize(Reader)) 468c099fe0SZachary Turner return EC; 478c099fe0SZachary Turner return V.visitInlineeLines(Fragment); 488c099fe0SZachary Turner } 49*349c18f8SZachary Turner case DebugSubsectionKind::CrossScopeExports: { 50*349c18f8SZachary Turner DebugCrossModuleExportsSubsectionRef Section; 51*349c18f8SZachary Turner if (auto EC = Section.initialize(Reader)) 52*349c18f8SZachary Turner return EC; 53*349c18f8SZachary Turner return V.visitCrossModuleExports(Section); 54*349c18f8SZachary Turner } 55*349c18f8SZachary Turner case DebugSubsectionKind::CrossScopeImports: { 56*349c18f8SZachary Turner DebugCrossModuleImportsSubsectionRef Section; 57*349c18f8SZachary Turner if (auto EC = Section.initialize(Reader)) 58*349c18f8SZachary Turner return EC; 59*349c18f8SZachary Turner return V.visitCrossModuleImports(Section); 60*349c18f8SZachary Turner } 618c099fe0SZachary Turner default: { 628c099fe0SZachary Turner DebugUnknownSubsectionRef Fragment(R.kind(), R.getRecordData()); 638c099fe0SZachary Turner return V.visitUnknown(Fragment); 648c099fe0SZachary Turner } 658c099fe0SZachary Turner } 668c099fe0SZachary Turner } 67