1 //===- DebugSubsectionVisitor.cpp ---------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h" 11 12 #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h" 13 #include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h" 14 #include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h" 15 #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h" 16 #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h" 17 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h" 18 #include "llvm/DebugInfo/CodeView/DebugUnknownSubsection.h" 19 #include "llvm/Support/BinaryStreamReader.h" 20 #include "llvm/Support/BinaryStreamRef.h" 21 22 using namespace llvm; 23 using namespace llvm::codeview; 24 25 Error llvm::codeview::visitDebugSubsection(const DebugSubsectionRecord &R, 26 DebugSubsectionVisitor &V) { 27 BinaryStreamReader Reader(R.getRecordData()); 28 switch (R.kind()) { 29 case DebugSubsectionKind::Lines: { 30 DebugLinesSubsectionRef Fragment; 31 if (auto EC = Fragment.initialize(Reader)) 32 return EC; 33 34 return V.visitLines(Fragment); 35 } 36 case DebugSubsectionKind::FileChecksums: { 37 DebugChecksumsSubsectionRef Fragment; 38 if (auto EC = Fragment.initialize(Reader)) 39 return EC; 40 41 return V.visitFileChecksums(Fragment); 42 } 43 case DebugSubsectionKind::InlineeLines: { 44 DebugInlineeLinesSubsectionRef Fragment; 45 if (auto EC = Fragment.initialize(Reader)) 46 return EC; 47 return V.visitInlineeLines(Fragment); 48 } 49 case DebugSubsectionKind::CrossScopeExports: { 50 DebugCrossModuleExportsSubsectionRef Section; 51 if (auto EC = Section.initialize(Reader)) 52 return EC; 53 return V.visitCrossModuleExports(Section); 54 } 55 case DebugSubsectionKind::CrossScopeImports: { 56 DebugCrossModuleImportsSubsectionRef Section; 57 if (auto EC = Section.initialize(Reader)) 58 return EC; 59 return V.visitCrossModuleImports(Section); 60 } 61 default: { 62 DebugUnknownSubsectionRef Fragment(R.kind(), R.getRecordData()); 63 return V.visitUnknown(Fragment); 64 } 65 } 66 } 67