@@ -1843,7 +1843,8 @@ static bool isRedeclarable(Decl::Kind K) {
18431843 llvm_unreachable (" unknown decl kind" );
18441844}
18451845
1846- bool NamedDecl::declarationReplaces (NamedDecl *OldD, bool IsKnownNewer) const {
1846+ bool NamedDecl::declarationReplaces (const NamedDecl *OldD,
1847+ bool IsKnownNewer) const {
18471848 assert (getDeclName () == OldD->getDeclName () && " Declaration name mismatch" );
18481849
18491850 // Never replace one imported declaration with another; we need both results
@@ -1873,13 +1874,13 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const {
18731874
18741875 // Using declarations can be replaced if they import the same name from the
18751876 // same context.
1876- if (auto *UD = dyn_cast<UsingDecl>(this )) {
1877+ if (const auto *UD = dyn_cast<UsingDecl>(this )) {
18771878 ASTContext &Context = getASTContext ();
18781879 return Context.getCanonicalNestedNameSpecifier (UD->getQualifier ()) ==
18791880 Context.getCanonicalNestedNameSpecifier (
18801881 cast<UsingDecl>(OldD)->getQualifier ());
18811882 }
1882- if (auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(this )) {
1883+ if (const auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(this )) {
18831884 ASTContext &Context = getASTContext ();
18841885 return Context.getCanonicalNestedNameSpecifier (UUVD->getQualifier ()) ==
18851886 Context.getCanonicalNestedNameSpecifier (
@@ -1896,7 +1897,7 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const {
18961897 // Check whether this is actually newer than OldD. We want to keep the
18971898 // newer declaration. This loop will usually only iterate once, because
18981899 // OldD is usually the previous declaration.
1899- for (auto *D : redecls ()) {
1900+ for (const auto *D : redecls ()) {
19001901 if (D == OldD)
19011902 break ;
19021903
0 commit comments