]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r306325, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / PDB / Native / ModuleDebugStream.h
1 //===- ModuleDebugStream.h - PDB Module Info Stream Access ----------------===//
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 #ifndef LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H
11 #define LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H
12
13 #include "llvm/ADT/iterator_range.h"
14 #include "llvm/DebugInfo/CodeView/CVRecord.h"
15 #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
16 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
17 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
18 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
19 #include "llvm/Support/BinaryStreamArray.h"
20 #include "llvm/Support/BinaryStreamRef.h"
21 #include "llvm/Support/Error.h"
22
23 namespace llvm {
24 namespace pdb {
25 class PDBFile;
26 class DbiModuleDescriptor;
27
28 class ModuleDebugStreamRef {
29   typedef codeview::DebugSubsectionArray::Iterator DebugSubsectionIterator;
30
31 public:
32   ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
33                        std::unique_ptr<msf::MappedBlockStream> Stream);
34   ModuleDebugStreamRef(ModuleDebugStreamRef &&Other) = default;
35   ~ModuleDebugStreamRef();
36
37   Error reload();
38
39   uint32_t signature() const { return Signature; }
40
41   iterator_range<codeview::CVSymbolArray::Iterator>
42   symbols(bool *HadError) const;
43
44   const codeview::CVSymbolArray &getSymbolArray() const { return SymbolArray; }
45
46   BinarySubstreamRef getSymbolsSubstream() const;
47   BinarySubstreamRef getC11LinesSubstream() const;
48   BinarySubstreamRef getC13LinesSubstream() const;
49   BinarySubstreamRef getGlobalRefsSubstream() const;
50
51   ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default;
52
53   llvm::iterator_range<DebugSubsectionIterator> subsections() const;
54
55   bool hasDebugSubsections() const;
56
57   Error commit();
58
59   Expected<codeview::DebugChecksumsSubsectionRef>
60   findChecksumsSubsection() const;
61
62 private:
63   const DbiModuleDescriptor &Mod;
64
65   uint32_t Signature;
66
67   std::shared_ptr<msf::MappedBlockStream> Stream;
68
69   codeview::CVSymbolArray SymbolArray;
70
71   BinarySubstreamRef SymbolsSubstream;
72   BinarySubstreamRef C11LinesSubstream;
73   BinarySubstreamRef C13LinesSubstream;
74   BinarySubstreamRef GlobalRefsSubstream;
75
76   codeview::DebugSubsectionArray Subsections;
77 };
78 }
79 }
80
81 #endif