@@ -1843,7 +1843,8 @@ static bool isRedeclarable(Decl::Kind K) {
1843
1843
llvm_unreachable (" unknown decl kind" );
1844
1844
}
1845
1845
1846
- bool NamedDecl::declarationReplaces (NamedDecl *OldD, bool IsKnownNewer) const {
1846
+ bool NamedDecl::declarationReplaces (const NamedDecl *OldD,
1847
+ bool IsKnownNewer) const {
1847
1848
assert (getDeclName () == OldD->getDeclName () && " Declaration name mismatch" );
1848
1849
1849
1850
// Never replace one imported declaration with another; we need both results
@@ -1873,13 +1874,13 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const {
1873
1874
1874
1875
// Using declarations can be replaced if they import the same name from the
1875
1876
// same context.
1876
- if (auto *UD = dyn_cast<UsingDecl>(this )) {
1877
+ if (const auto *UD = dyn_cast<UsingDecl>(this )) {
1877
1878
ASTContext &Context = getASTContext ();
1878
1879
return Context.getCanonicalNestedNameSpecifier (UD->getQualifier ()) ==
1879
1880
Context.getCanonicalNestedNameSpecifier (
1880
1881
cast<UsingDecl>(OldD)->getQualifier ());
1881
1882
}
1882
- if (auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(this )) {
1883
+ if (const auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(this )) {
1883
1884
ASTContext &Context = getASTContext ();
1884
1885
return Context.getCanonicalNestedNameSpecifier (UUVD->getQualifier ()) ==
1885
1886
Context.getCanonicalNestedNameSpecifier (
@@ -1896,7 +1897,7 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD, bool IsKnownNewer) const {
1896
1897
// Check whether this is actually newer than OldD. We want to keep the
1897
1898
// newer declaration. This loop will usually only iterate once, because
1898
1899
// OldD is usually the previous declaration.
1899
- for (auto *D : redecls ()) {
1900
+ for (const auto *D : redecls ()) {
1900
1901
if (D == OldD)
1901
1902
break ;
1902
1903
0 commit comments