@@ -30,19 +30,21 @@ void ODRHash::AddIdentifierInfo(const IdentifierInfo *II) {
3030 ID.AddString (II->getName ());
3131}
3232
33- void ODRHash::AddDeclarationName (DeclarationName Name, bool TreatAsDecl) {
33+ void ODRHash::AddDeclarationNameInfo (DeclarationNameInfo NameInfo,
34+ bool TreatAsDecl) {
3435 if (TreatAsDecl)
3536 // Matches the NamedDecl check in AddDecl
3637 AddBoolean (true );
3738
38- AddDeclarationNameImpl (Name );
39+ AddDeclarationNameInfoImpl (NameInfo );
3940
4041 if (TreatAsDecl)
4142 // Matches the ClassTemplateSpecializationDecl check in AddDecl
4243 AddBoolean (false );
4344}
4445
45- void ODRHash::AddDeclarationNameImpl (DeclarationName Name) {
46+ void ODRHash::AddDeclarationNameInfoImpl (DeclarationNameInfo NameInfo) {
47+ DeclarationName Name = NameInfo.getName ();
4648 // Index all DeclarationName and use index numbers to refer to them.
4749 auto Result = DeclNameMap.insert (std::make_pair (Name, DeclNameMap.size ()));
4850 ID.AddInteger (Result.first ->second );
@@ -85,17 +87,18 @@ void ODRHash::AddDeclarationNameImpl(DeclarationName Name) {
8587 }
8688 case DeclarationName::CXXConstructorName:
8789 case DeclarationName::CXXDestructorName:
88- AddQualType (Name.getCXXNameType ());
90+ case DeclarationName::CXXConversionFunctionName:
91+ if (auto *TSI = NameInfo.getNamedTypeInfo ())
92+ AddQualType (TSI->getType ());
93+ else
94+ AddQualType (Name.getCXXNameType ());
8995 break ;
9096 case DeclarationName::CXXOperatorName:
9197 ID.AddInteger (Name.getCXXOverloadedOperator ());
9298 break ;
9399 case DeclarationName::CXXLiteralOperatorName:
94100 AddIdentifierInfo (Name.getCXXLiteralIdentifier ());
95101 break ;
96- case DeclarationName::CXXConversionFunctionName:
97- AddQualType (Name.getCXXNameType ());
98- break ;
99102 case DeclarationName::CXXUsingDirective:
100103 break ;
101104 case DeclarationName::CXXDeductionGuideName: {
@@ -314,7 +317,10 @@ class ODRDeclVisitor : public ConstDeclVisitor<ODRDeclVisitor> {
314317 }
315318
316319 void VisitNamedDecl (const NamedDecl *D) {
317- Hash.AddDeclarationName (D->getDeclName ());
320+ if (const auto *FD = dyn_cast<FunctionDecl>(D))
321+ Hash.AddDeclarationNameInfo (FD->getNameInfo ());
322+ else
323+ Hash.AddDeclarationName (D->getDeclName ());
318324 Inherited::VisitNamedDecl (D);
319325 }
320326
@@ -828,7 +834,10 @@ void ODRHash::AddDecl(const Decl *D) {
828834 return ;
829835 }
830836
831- AddDeclarationName (ND->getDeclName ());
837+ if (auto *FD = dyn_cast<FunctionDecl>(D))
838+ AddDeclarationNameInfo (FD->getNameInfo ());
839+ else
840+ AddDeclarationName (ND->getDeclName ());
832841
833842 // If this was a specialization we should take into account its template
834843 // arguments. This helps to reduce collisions coming when visiting template
@@ -1017,7 +1026,7 @@ class ODRTypeVisitor : public TypeVisitor<ODRTypeVisitor> {
10171026 }
10181027
10191028 void VisitDecltypeType (const DecltypeType *T) {
1020- AddStmt (T->getUnderlyingExpr ());
1029+ Hash. AddStmt (T->getUnderlyingExpr ());
10211030 VisitType (T);
10221031 }
10231032
0 commit comments