LLVM: include/llvm/DWARFLinker/Classic/DWARFLinkerDeclContext.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_DWARFLINKER_CLASSIC_DWARFLINKERDECLCONTEXT_H
10#define LLVM_DWARFLINKER_CLASSIC_DWARFLINKERDECLCONTEXT_H
11
21#include
22
23namespace llvm {
26
29
30
31
32
33
35public:
36
37
42
43
44
45 auto [It, Inserted] = ResolvedPaths.try_emplace(ParentPath);
46 if (Inserted) {
49 It->second = std::string(RealPath);
50 }
51
52
55 return StringPool.internString(ResolvedPath);
56 }
57
58private:
60};
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
81public:
83
84 DeclContext() : DefinedInClangModule(0), Parent(*this) {}
85
89 unsigned CUId = 0)
90 : QualifiedNameHash(Hash), Line(Line), ByteSize(ByteSize), Tag(Tag),
91 DefinedInClangModule(0), Name(Name), NameForUniquing(NameForUniquing),
92 File(File), Parent(Parent), LastSeenDIE(LastSeenDIE),
93 LastSeenCompileUnitID(CUId) {}
94
96
98
100
102
106
109
111
112private:
114
115 unsigned QualifiedNameHash = 0;
118 uint16_t Tag = dwarf::DW_TAG_compile_unit;
119 unsigned DefinedInClangModule : 1;
125 uint32_t LastSeenCompileUnitID = 0;
126 std::atomic<uint32_t> CanonicalDIEOffset = {0};
127 bool HasCanonicalDIE = false;
128};
129
130
131
132
134public:
135
136
137
138
139
140
141
142
143
144
145
149 bool InClangModule);
150
152
153private:
157
158
159
161 ResolvedPathsMap ResolvedPaths;
162
163
165
166
168
171};
172
173
177
179 return Ctxt->QualifiedNameHash;
180 }
181
183 if (RHS == getEmptyKey() || RHS == getTombstoneKey())
185 return LHS->QualifiedNameHash == RHS->QualifiedNameHash &&
186 LHS->Line == RHS->Line && LHS->ByteSize == RHS->ByteSize &&
187 LHS->NameForUniquing.data() == RHS->NameForUniquing.data() &&
188 LHS->File.data() == RHS->File.data() &&
189 LHS->Parent.QualifiedNameHash == RHS->Parent.QualifiedNameHash;
190 }
191};
192
193}
194}
195}
196
197#endif
This file defines DenseMapInfo traits for DenseMap.
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
A structured debug information entry.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
Implements a dense probed hash-table based set.
A string table that doesn't need relocations.
PointerIntPair - This class implements a pair of a pointer and small integer.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
Small helper that resolves and caches file paths.
Definition DWARFLinkerDeclContext.h:34
StringRef resolve(const std::string &Path, NonRelocatableStringpool &StringPool)
Resolve a path by calling realpath and cache its result.
Definition DWARFLinkerDeclContext.h:38
Stores all information relating to a compile unit, be it in its original instance in the object file ...
This class gives a tree-like API to the DenseMap that stores the DeclContext objects.
Definition DWARFLinkerDeclContext.h:133
PointerIntPair< DeclContext *, 1 > getChildDeclContext(DeclContext &Context, const DWARFDie &DIE, CompileUnit &Unit, bool InClangModule)
Get the child of Context described by DIE in Unit.
DeclContext & getRoot()
Definition DWARFLinkerDeclContext.h:151
A DeclContext is a named program scope that is used for ODR uniquing of types.
Definition DWARFLinkerDeclContext.h:80
bool hasCanonicalDIE() const
Definition DWARFLinkerDeclContext.h:101
DenseSet< DeclContext *, DeclMapInfo > Map
Definition DWARFLinkerDeclContext.h:82
uint32_t getCanonicalDIEOffset() const
Definition DWARFLinkerDeclContext.h:103
DeclContext(unsigned Hash, uint32_t Line, uint32_t ByteSize, uint16_t Tag, StringRef Name, StringRef NameForUniquing, StringRef File, const DeclContext &Parent, DWARFDie LastSeenDIE=DWARFDie(), unsigned CUId=0)
Definition DWARFLinkerDeclContext.h:86
llvm::StringRef getCanonicalName() const
Definition DWARFLinkerDeclContext.h:105
uint32_t getQualifiedNameHash() const
Definition DWARFLinkerDeclContext.h:95
uint16_t getTag() const
Definition DWARFLinkerDeclContext.h:110
bool isDefinedInClangModule() const
Definition DWARFLinkerDeclContext.h:107
void setHasCanonicalDIE()
Definition DWARFLinkerDeclContext.h:99
void setDefinedInClangModule(bool Val)
Definition DWARFLinkerDeclContext.h:108
void setCanonicalDIEOffset(uint32_t Offset)
Definition DWARFLinkerDeclContext.h:104
bool setLastSeenDIE(CompileUnit &U, const DWARFDie &Die)
Set the last DIE/CU a context was seen in and, possibly invalidate the context if it is ambiguous.
DeclContext()
Definition DWARFLinkerDeclContext.h:84
LLVM_ABI std::error_code real_path(const Twine &path, SmallVectorImpl< char > &output, bool expand_tilde=false)
Collapse all .
LLVM_ABI StringRef parent_path(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get parent path.
LLVM_ABI StringRef filename(StringRef path LLVM_LIFETIME_BOUND, Style style=Style::native)
Get filename.
LLVM_ABI void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
An information struct used to provide DenseMap with the various necessary components for a given valu...
Info type for the DenseMap storing the DeclContext pointers.
Definition DWARFLinkerDeclContext.h:174
static unsigned getHashValue(const DeclContext *Ctxt)
Definition DWARFLinkerDeclContext.h:178
static bool isEqual(const DeclContext *LHS, const DeclContext *RHS)
Definition DWARFLinkerDeclContext.h:182