njames93 updated this revision to Diff 251910. njames93 added a comment. - Address `auto` and add test cases.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76549/new/ https://reviews.llvm.org/D76549 Files: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp +++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp @@ -532,3 +532,16 @@ using namespace FOO_NS::InlineNamespace; // CHECK-FIXES: {{^}}using namespace foo_ns::inline_namespace; + +void QualifiedTypeLocTest(THIS___Structure); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(this_structure);{{$}} +void QualifiedTypeLocTest(THIS___Structure &); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(this_structure &);{{$}} +void QualifiedTypeLocTest(THIS___Structure &&); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(this_structure &&);{{$}} +void QualifiedTypeLocTest(const THIS___Structure); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(const this_structure);{{$}} +void QualifiedTypeLocTest(const THIS___Structure &); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(const this_structure &);{{$}} +void QualifiedTypeLocTest(volatile THIS___Structure &); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(volatile this_structure &);{{$}} Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp +++ clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp @@ -57,7 +57,7 @@ inline reference_wrapper<const Up> 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<const Up>(u); } Index: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp +++ clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp @@ -203,14 +203,15 @@ } if (const auto *Loc = Result.Nodes.getNodeAs<TypeLoc>("typeLoc")) { + UnqualTypeLoc Unqual = Loc->getUnqualifiedLoc(); NamedDecl *Decl = nullptr; - if (const auto &Ref = Loc->getAs<TagTypeLoc>()) + if (const auto &Ref = Unqual.getAs<TagTypeLoc>()) Decl = Ref.getDecl(); - else if (const auto &Ref = Loc->getAs<InjectedClassNameTypeLoc>()) + else if (const auto &Ref = Unqual.getAs<InjectedClassNameTypeLoc>()) Decl = Ref.getDecl(); - else if (const auto &Ref = Loc->getAs<UnresolvedUsingTypeLoc>()) + else if (const auto &Ref = Unqual.getAs<UnresolvedUsingTypeLoc>()) Decl = Ref.getDecl(); - else if (const auto &Ref = Loc->getAs<TemplateTypeParmTypeLoc>()) + else if (const auto &Ref = Unqual.getAs<TemplateTypeParmTypeLoc>()) Decl = Ref.getDecl(); // further TypeLocs handled below
Index: clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp +++ clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming.cpp @@ -532,3 +532,16 @@ using namespace FOO_NS::InlineNamespace; // CHECK-FIXES: {{^}}using namespace foo_ns::inline_namespace; + +void QualifiedTypeLocTest(THIS___Structure); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(this_structure);{{$}} +void QualifiedTypeLocTest(THIS___Structure &); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(this_structure &);{{$}} +void QualifiedTypeLocTest(THIS___Structure &&); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(this_structure &&);{{$}} +void QualifiedTypeLocTest(const THIS___Structure); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(const this_structure);{{$}} +void QualifiedTypeLocTest(const THIS___Structure &); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(const this_structure &);{{$}} +void QualifiedTypeLocTest(volatile THIS___Structure &); +// CHECK-FIXES: {{^}}void QualifiedTypeLocTest(volatile this_structure &);{{$}} Index: clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp +++ clang-tools-extra/test/clang-tidy/checkers/bugprone-reserved-identifier-invert.cpp @@ -57,7 +57,7 @@ inline reference_wrapper<const Up> 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<const Up>(u); } Index: clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp +++ clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp @@ -203,14 +203,15 @@ } if (const auto *Loc = Result.Nodes.getNodeAs<TypeLoc>("typeLoc")) { + UnqualTypeLoc Unqual = Loc->getUnqualifiedLoc(); NamedDecl *Decl = nullptr; - if (const auto &Ref = Loc->getAs<TagTypeLoc>()) + if (const auto &Ref = Unqual.getAs<TagTypeLoc>()) Decl = Ref.getDecl(); - else if (const auto &Ref = Loc->getAs<InjectedClassNameTypeLoc>()) + else if (const auto &Ref = Unqual.getAs<InjectedClassNameTypeLoc>()) Decl = Ref.getDecl(); - else if (const auto &Ref = Loc->getAs<UnresolvedUsingTypeLoc>()) + else if (const auto &Ref = Unqual.getAs<UnresolvedUsingTypeLoc>()) Decl = Ref.getDecl(); - else if (const auto &Ref = Loc->getAs<TemplateTypeParmTypeLoc>()) + else if (const auto &Ref = Unqual.getAs<TemplateTypeParmTypeLoc>()) Decl = Ref.getDecl(); // further TypeLocs handled below
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits