Line data Source code
1 : //===- ModuleDebugFragmentVisitor.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/ModuleDebugFragmentVisitor.h"
11 :
12 : #include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"
13 : #include "llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h"
14 : #include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"
15 : #include "llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h"
16 : #include "llvm/DebugInfo/CodeView/ModuleDebugUnknownFragment.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 9 : Error llvm::codeview::visitModuleDebugFragment(
24 : const ModuleDebugFragmentRecord &R, ModuleDebugFragmentVisitor &V) {
25 27 : BinaryStreamReader Reader(R.getRecordData());
26 9 : switch (R.kind()) {
27 : case ModuleDebugFragmentKind::Lines: {
28 8 : ModuleDebugLineFragmentRef Fragment;
29 16 : if (auto EC = Fragment.initialize(Reader))
30 0 : return EC;
31 :
32 4 : return V.visitLines(Fragment);
33 : }
34 : case ModuleDebugFragmentKind::FileChecksums: {
35 8 : ModuleDebugFileChecksumFragmentRef Fragment;
36 16 : if (auto EC = Fragment.initialize(Reader))
37 0 : return EC;
38 :
39 4 : return V.visitFileChecksums(Fragment);
40 : }
41 : case ModuleDebugFragmentKind::InlineeLines: {
42 2 : ModuleDebugInlineeLineFragmentRef Fragment;
43 4 : if (auto EC = Fragment.initialize(Reader))
44 0 : return EC;
45 1 : return V.visitInlineeLines(Fragment);
46 : }
47 : default: {
48 0 : ModuleDebugUnknownFragmentRef Fragment(R.kind(), R.getRecordData());
49 0 : return V.visitUnknown(Fragment);
50 : }
51 : }
52 : }
|