33 uint32_t FirstIdx = OrigUnit.getDIEIndex(LastSeenDIE);
46 unsigned Tag = DIE.
getTag();
56 case dwarf::DW_TAG_module:
58 case dwarf::DW_TAG_compile_unit:
60 case dwarf::DW_TAG_subprogram:
62 if ((Context.
getTag() == dwarf::DW_TAG_namespace ||
63 Context.
getTag() == dwarf::DW_TAG_compile_unit) &&
67 case dwarf::DW_TAG_member:
68 case dwarf::DW_TAG_namespace:
69 case dwarf::DW_TAG_structure_type:
70 case dwarf::DW_TAG_class_type:
71 case dwarf::DW_TAG_union_type:
72 case dwarf::DW_TAG_enumeration_type:
73 case dwarf::DW_TAG_typedef:
90 NameRef = StringPool.internString(Name);
91 else if (Tag == dwarf::DW_TAG_namespace)
94 NameRef = StringPool.internString(
"(anonymous namespace)");
96 if (ShortName && ShortName != Name)
97 ShortNameRef = StringPool.internString(ShortName);
99 ShortNameRef = NameRef;
101 if (Tag != dwarf::DW_TAG_class_type && Tag != dwarf::DW_TAG_structure_type &&
102 Tag != dwarf::DW_TAG_union_type &&
103 Tag != dwarf::DW_TAG_enumeration_type && NameRef.
empty())
109 if (!InClangModule) {
120 if (Tag != dwarf::DW_TAG_namespace || !Name) {
121 if (
unsigned FileNum =
128 if (!Name && Tag == dwarf::DW_TAG_namespace)
131 if (
LT->hasFileAtIndex(FileNum)) {
136 if (!ResolvedPath.empty()) {
137 FileRef = ResolvedPath;
140 bool FoundFileName =
LT->getFileNameByIndex(
145 assert(FoundFileName &&
"Must get file name from line table");
148 FileRef = PathResolver.resolve(File, StringPool);
157 if (!Line && NameRef.
empty())
174 if (Tag == dwarf::DW_TAG_namespace && NameRef ==
"(anonymous namespace)")
178 DeclContext Key(Hash, Line, ByteSize, Tag, NameRef, FileRef, Context);
179 auto ContextIter = Contexts.find(&Key);
181 if (ContextIter == Contexts.end()) {
187 std::tie(ContextIter, Inserted) = Contexts.insert(NewContext);
188 assert(Inserted &&
"Failed to insert DeclContext");
190 }
else if (Tag != dwarf::DW_TAG_namespace &&
191 !(*ContextIter)->setLastSeenDIE(U, DIE)) {
197 assert(ContextIter != Contexts.end());
200 if ((Tag == dwarf::DW_TAG_subprogram &&
201 Context.
getTag() != dwarf::DW_TAG_structure_type &&
202 Context.
getTag() != dwarf::DW_TAG_class_type) ||
203 (Tag == dwarf::DW_TAG_union_type))
A DeclContext is a named program scope that is used for ODR uniquing of types.
This class represents lattice values for constants.
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...
Stores all information relating to a compile unit, be it in its original instance in the object file ...
const DWARFDebugLine::LineTable * getLineTableForUnit(DWARFUnit *U)
Get a pointer to a parsed line table corresponding to a compile unit.
StringPool - An interned string pool.
const char * getCompilationDir()
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Helper for making strong types.
uint32_t getQualifiedNameHash() const
void setResolvedPath(unsigned FileNum, StringRef Path)
Set the fully resolved path for the line-table's file FileNum to Path.
Utility class that carries the DWARF compile/type unit and the debug info entry in an object...
unsigned getUniqueID() const
StringRef getResolvedPath(unsigned FileNum)
Get the full path for file FileNum in the line table.
PointerIntPair - This class implements a pair of a pointer and small integer.
A structured debug information entry.
DWARFContext & getContext() const
DeclContext * Ctxt
ODR Declaration context.
const char * getName(DINameKind Kind) const
Return the DIE name resolving DW_AT_sepcification or DW_AT_abstract_origin references if necessary...
DIEInfo & getInfo(unsigned Idx)
Align max(MaybeAlign Lhs, Align Rhs)
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
PointerIntPair< DeclContext *, 1 > getChildDeclContext(DeclContext &Context, const DWARFDie &DIE, CompileUnit &Unit, UniquingStringPool &StringPool, bool InClangModule)
Get the child of Context described by DIE in Unit.
dwarf::Tag getTag() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Optional< DWARFFormValue > find(dwarf::Attribute Attr) const
Extract the specified attribute from this DIE.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
StringRef - Represent a constant reference to a string, i.e.
Optional< uint64_t > toUnsigned(const Optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract an unsigned constant.
DWARFUnit & getOrigUnit() const