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