diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp --- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp +++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp @@ -203,14 +203,15 @@ } if (const auto *Loc = Result.Nodes.getNodeAs("typeLoc")) { + auto Unqual = Loc->getUnqualifiedLoc(); NamedDecl *Decl = nullptr; - if (const auto &Ref = Loc->getAs()) + if (const auto &Ref = Unqual.getAs()) Decl = Ref.getDecl(); - else if (const auto &Ref = Loc->getAs()) + else if (const auto &Ref = Unqual.getAs()) Decl = Ref.getDecl(); - else if (const auto &Ref = Loc->getAs()) + else if (const auto &Ref = Unqual.getAs()) Decl = Ref.getDecl(); - else if (const auto &Ref = Loc->getAs()) + else if (const auto &Ref = Unqual.getAs()) Decl = Ref.getDecl(); // further TypeLocs handled below diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp --- a/clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp @@ -57,7 +57,7 @@ inline reference_wrapper cref(const Up &u) noexcept { // CHECK-MESSAGES: :[[@LINE-1]]:16: warning: declaration uses identifier 'u', which is not a reserved identifier [bugprone-reserved-identifier] - // CHECK-FIXES: {{^}}cref(const Up &__u) noexcept {{{$}} + // CHECK-FIXES: {{^}}cref(const _Up &__u) noexcept {{{$}} return reference_wrapper(u); }