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/DebugInlineeLinesSubsection.h" 14 #include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h" 15 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h" 16 #include "llvm/DebugInfo/CodeView/DebugUnknownSubsection.h" 17 #include "llvm/Support/BinaryStreamReader.h" 18 #include "llvm/Support/BinaryStreamRef.h" 19 20 using namespace llvm; 21 using namespace llvm::codeview; 22 23 Error llvm::codeview::visitDebugSubsection(const DebugSubsectionRecord &R, 24 DebugSubsectionVisitor &V) { 25 BinaryStreamReader Reader(R.getRecordData()); 26 switch (R.kind()) { 27 case DebugSubsectionKind::Lines: { 28 DebugLinesSubsectionRef Fragment; 29 if (auto EC = Fragment.initialize(Reader)) 30 return EC; 31 32 return V.visitLines(Fragment); 33 } 34 case DebugSubsectionKind::FileChecksums: { 35 DebugChecksumsSubsectionRef Fragment; 36 if (auto EC = Fragment.initialize(Reader)) 37 return EC; 38 39 return V.visitFileChecksums(Fragment); 40 } 41 case DebugSubsectionKind::InlineeLines: { 42 DebugInlineeLinesSubsectionRef Fragment; 43 if (auto EC = Fragment.initialize(Reader)) 44 return EC; 45 return V.visitInlineeLines(Fragment); 46 } 47 default: { 48 DebugUnknownSubsectionRef Fragment(R.kind(), R.getRecordData()); 49 return V.visitUnknown(Fragment); 50 } 51 } 52 } 53