blob: f2c4dea8685fbe1ac9c2ac4d93fe376d0a5f66b5 [file] [log] [blame]
Zachary Turner8c099fe2017-05-30 16:36:15 +00001//===- 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
20using namespace llvm;
21using namespace llvm::codeview;
22
23Error 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}