[Alignment][NFC] Convert StoreInst to MaybeAlign
[llvm-complete.git] / include / llvm / DebugInfo / PDB / Native / ModuleDebugStream.h
blobcb1ffc729512441afbe832cbac7614d39341725e
1 //===- ModuleDebugStream.h - PDB Module Info Stream Access ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
10 #define LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
12 #include "llvm/ADT/iterator_range.h"
13 #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
14 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
15 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
16 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
17 #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
18 #include "llvm/Support/BinaryStreamRef.h"
19 #include "llvm/Support/Error.h"
20 #include <cstdint>
21 #include <memory>
23 namespace llvm {
24 namespace pdb {
26 class DbiModuleDescriptor;
28 class ModuleDebugStreamRef {
29 using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator;
31 public:
32 ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
33 std::unique_ptr<msf::MappedBlockStream> Stream);
34 ModuleDebugStreamRef(ModuleDebugStreamRef &&Other) = default;
35 ModuleDebugStreamRef(const ModuleDebugStreamRef &Other) = default;
36 ~ModuleDebugStreamRef();
38 Error reload();
40 uint32_t signature() const { return Signature; }
42 iterator_range<codeview::CVSymbolArray::Iterator>
43 symbols(bool *HadError) const;
45 const codeview::CVSymbolArray &getSymbolArray() const { return SymbolArray; }
46 const codeview::CVSymbolArray
47 getSymbolArrayForScope(uint32_t ScopeBegin) const;
49 BinarySubstreamRef getSymbolsSubstream() const;
50 BinarySubstreamRef getC11LinesSubstream() const;
51 BinarySubstreamRef getC13LinesSubstream() const;
52 BinarySubstreamRef getGlobalRefsSubstream() const;
54 ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = delete;
56 codeview::CVSymbol readSymbolAtOffset(uint32_t Offset) const;
58 iterator_range<DebugSubsectionIterator> subsections() const;
59 codeview::DebugSubsectionArray getSubsectionsArray() const {
60 return Subsections;
63 bool hasDebugSubsections() const;
65 Error commit();
67 Expected<codeview::DebugChecksumsSubsectionRef>
68 findChecksumsSubsection() const;
70 private:
71 Error reloadSerialize(BinaryStreamReader &Reader);
73 DbiModuleDescriptor Mod;
75 uint32_t Signature;
77 std::shared_ptr<msf::MappedBlockStream> Stream;
79 codeview::CVSymbolArray SymbolArray;
81 BinarySubstreamRef SymbolsSubstream;
82 BinarySubstreamRef C11LinesSubstream;
83 BinarySubstreamRef C13LinesSubstream;
84 BinarySubstreamRef GlobalRefsSubstream;
86 codeview::DebugSubsectionArray Subsections;
89 } // end namespace pdb
90 } // end namespace llvm
92 #endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H