34 uint32_t FirstIdx = OrigUnit.getDIEIndex(LastSeenDIE);
57 case dwarf::DW_TAG_module:
59 case dwarf::DW_TAG_compile_unit:
61 case dwarf::DW_TAG_subprogram:
63 if ((
Context.getTag() == dwarf::DW_TAG_namespace ||
64 Context.getTag() == dwarf::DW_TAG_compile_unit) &&
68 case dwarf::DW_TAG_member:
69 case dwarf::DW_TAG_namespace:
70 case dwarf::DW_TAG_structure_type:
71 case dwarf::DW_TAG_class_type:
72 case dwarf::DW_TAG_union_type:
73 case dwarf::DW_TAG_enumeration_type:
74 case dwarf::DW_TAG_typedef:
92 bool IsAnonymousNamespace = NameRef.
empty() &&
Tag == dwarf::DW_TAG_namespace;
93 if (IsAnonymousNamespace) {
96 NameRef =
"(anonymous namespace)";
99 if (
Tag != dwarf::DW_TAG_class_type &&
Tag != dwarf::DW_TAG_structure_type &&
100 Tag != dwarf::DW_TAG_union_type &&
101 Tag != dwarf::DW_TAG_enumeration_type && NameRef.
empty())
107 if (!InClangModule) {
118 if (
Tag != dwarf::DW_TAG_namespace || IsAnonymousNamespace) {
119 if (
unsigned FileNum =
126 if (IsAnonymousNamespace)
129 if (
LT->hasFileAtIndex(FileNum)) {
133 FileRef = getResolvedPath(U, FileNum, *
LT);
140 if (!Line && NameRef.
empty())
157 if (IsAnonymousNamespace)
162 auto ContextIter = Contexts.
find(&
Key);
164 if (ContextIter == Contexts.
end()) {
168 new (Allocator)
DeclContext(Hash, Line, ByteSize,
Tag, NameRef, FileRef,
170 std::tie(ContextIter, Inserted) = Contexts.
insert(NewContext);
171 assert(Inserted &&
"Failed to insert DeclContext");
173 }
else if (
Tag != dwarf::DW_TAG_namespace &&
174 !(*ContextIter)->setLastSeenDIE(U,
DIE)) {
183 if ((
Tag == dwarf::DW_TAG_subprogram &&
184 Context.getTag() != dwarf::DW_TAG_structure_type &&
185 Context.getTag() != dwarf::DW_TAG_class_type) ||
186 (
Tag == dwarf::DW_TAG_union_type))
193 DeclContextTree::getResolvedPath(
CompileUnit &
CU,
unsigned FileNum,
195 std::pair<unsigned, unsigned>
Key = {
CU.getUniqueID(), FileNum};
198 if (It == ResolvedPaths.
end()) {
199 std::string FileName;
201 FileNum,
CU.getOrigUnit().getCompilationDir(),
204 assert(FoundFileName &&
"Must get file name from line table");
208 StringRef ResolvedPath = PathResolver.
resolve(FileName, StringPool);
210 It = ResolvedPaths.
insert(std::make_pair(
Key, ResolvedPath)).first;