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