@@ -84,24 +84,25 @@ DeclContextTree::getChildDeclContext(DeclContext &Context, const DWARFDie &DIE,
8484 break ;
8585 }
8686
87- StringRef NameRef ;
87+ StringRef NameForUniquing ;
8888 StringRef FileRef;
8989
9090 if (const char *LinkageName = DIE.getLinkageName ())
91- NameRef = StringPool.internString (LinkageName);
91+ NameForUniquing = StringPool.internString (LinkageName);
9292 else if (const char *ShortName = DIE.getShortName ())
93- NameRef = StringPool.internString (ShortName);
93+ NameForUniquing = StringPool.internString (ShortName);
9494
95- bool IsAnonymousNamespace = NameRef.empty () && Tag == dwarf::DW_TAG_namespace;
95+ bool IsAnonymousNamespace =
96+ NameForUniquing.empty () && Tag == dwarf::DW_TAG_namespace;
9697 if (IsAnonymousNamespace) {
9798 // FIXME: For dsymutil-classic compatibility. I think uniquing within
9899 // anonymous namespaces is wrong. There is no ODR guarantee there.
99- NameRef = " (anonymous namespace)" ;
100+ NameForUniquing = " (anonymous namespace)" ;
100101 }
101102
102103 if (Tag != dwarf::DW_TAG_class_type && Tag != dwarf::DW_TAG_structure_type &&
103104 Tag != dwarf::DW_TAG_union_type &&
104- Tag != dwarf::DW_TAG_enumeration_type && NameRef .empty ())
105+ Tag != dwarf::DW_TAG_enumeration_type && NameForUniquing .empty ())
105106 return PointerIntPair<DeclContext *, 1 >(nullptr );
106107
107108 unsigned Line = 0 ;
@@ -140,10 +141,10 @@ DeclContextTree::getChildDeclContext(DeclContext &Context, const DWARFDie &DIE,
140141 }
141142 }
142143
143- if (!Line && NameRef .empty ())
144+ if (!Line && NameForUniquing .empty ())
144145 return PointerIntPair<DeclContext *, 1 >(nullptr );
145146
146- // We hash NameRef , which is the mangled name, in order to get most
147+ // We hash NameForUniquing , which is the mangled name, in order to get most
147148 // overloaded functions resolve correctly.
148149 //
149150 // Strictly speaking, hashing the Tag is only necessary for a
@@ -153,23 +154,24 @@ DeclContextTree::getChildDeclContext(DeclContext &Context, const DWARFDie &DIE,
153154 // FIXME: dsymutil-classic won't unique the same type presented
154155 // once as a struct and once as a class. Using the Tag in the fully
155156 // qualified name hash to get the same effect.
156- unsigned Hash = hash_combine (Context.getQualifiedNameHash (), Tag, NameRef);
157+ unsigned Hash =
158+ hash_combine (Context.getQualifiedNameHash (), Tag, NameForUniquing);
157159
158160 // FIXME: dsymutil-classic compatibility: when we don't have a name,
159161 // use the filename.
160162 if (IsAnonymousNamespace)
161163 Hash = hash_combine (Hash, FileRef);
162164
163165 // Now look if this context already exists.
164- DeclContext Key (Hash, Line, ByteSize, Tag, NameRef , FileRef, Context);
166+ DeclContext Key (Hash, Line, ByteSize, Tag, NameForUniquing , FileRef, Context);
165167 auto ContextIter = Contexts.find (&Key);
166168
167169 if (ContextIter == Contexts.end ()) {
168170 // The context wasn't found.
169171 bool Inserted;
170172 DeclContext *NewContext =
171- new (Allocator) DeclContext (Hash, Line, ByteSize, Tag, NameRef, FileRef ,
172- Context, DIE, U.getUniqueID ());
173+ new (Allocator) DeclContext (Hash, Line, ByteSize, Tag, NameForUniquing ,
174+ FileRef, Context, DIE, U.getUniqueID ());
173175 std::tie (ContextIter, Inserted) = Contexts.insert (NewContext);
174176 assert (Inserted && " Failed to insert DeclContext" );
175177 (void )Inserted;
0 commit comments