LLVM 22.0.0git
DWARFDebugAbbrev.h
Go to the documentation of this file.
1//===- DWARFDebugAbbrev.h ---------------------------------------*- 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//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGABBREV_H
10#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGABBREV_H
11
15#include <cstdint>
16#include <map>
17#include <vector>
18
19namespace llvm {
20
21class raw_ostream;
22
24 uint64_t Offset;
25 /// Code of the first abbreviation, if all abbreviations in the set have
26 /// consecutive codes. UINT32_MAX otherwise.
27 uint32_t FirstAbbrCode;
28 std::vector<DWARFAbbreviationDeclaration> Decls;
29
30 using const_iterator =
31 std::vector<DWARFAbbreviationDeclaration>::const_iterator;
32
33public:
35
36 uint64_t getOffset() const { return Offset; }
37 LLVM_ABI void dump(raw_ostream &OS) const;
39
42
43 const_iterator begin() const {
44 return Decls.begin();
45 }
46
47 const_iterator end() const {
48 return Decls.end();
49 }
50
51 LLVM_ABI std::string getCodeRange() const;
52
53 uint32_t getFirstAbbrCode() const { return FirstAbbrCode; }
54
55private:
56 void clear();
57};
58
60 using DWARFAbbreviationDeclarationSetMap =
61 std::map<uint64_t, DWARFAbbreviationDeclarationSet>;
62
63 mutable DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
64 mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
65 mutable std::optional<DataExtractor> Data;
66
67public:
69
71 getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const;
72
73 LLVM_ABI void dump(raw_ostream &OS) const;
74 LLVM_ABI Error parse() const;
75
76 DWARFAbbreviationDeclarationSetMap::const_iterator begin() const {
77 assert(!Data && "Must call parse before iterating over DWARFDebugAbbrev");
78 return AbbrDeclSets.begin();
79 }
80
81 DWARFAbbreviationDeclarationSetMap::const_iterator end() const {
82 return AbbrDeclSets.end();
83 }
84};
85
86} // end namespace llvm
87
88#endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGABBREV_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI
Definition: Compiler.h:213
loop extract
raw_pwrite_stream & OS
LLVM_ABI void dump(raw_ostream &OS) const
LLVM_ABI const DWARFAbbreviationDeclaration * getAbbreviationDeclaration(uint32_t AbbrCode) const
LLVM_ABI std::string getCodeRange() const
LLVM_ABI Expected< const DWARFAbbreviationDeclarationSet * > getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const
LLVM_ABI Error parse() const
DWARFAbbreviationDeclarationSetMap::const_iterator end() const
LLVM_ABI void dump(raw_ostream &OS) const
DWARFAbbreviationDeclarationSetMap::const_iterator begin() const
Lightweight error class with error context and mandatory checking.
Definition: Error.h:159
Tagged union holding either a T or a Error.
Definition: Error.h:485
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18