llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-tidy Author: Zeyi Xu (zeyi2) <details> <summary>Changes</summary> Record parameter pack usages held by `SizeOfPackExpr` in the common renamer visitor. This ensures that declarations and `sizeof...` references are renamed together. Closes #<!-- -->219154 --- Full diff: https://github.com/llvm/llvm-project/pull/219155.diff 3 Files Affected: - (modified) clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp (+5) - (modified) clang-tools-extra/docs/ReleaseNotes.md (+3) - (modified) clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp (+2) ``````````diff diff --git a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp index 943c21a14c6d9..7b984891803e5 100644 --- a/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp +++ b/clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp @@ -276,6 +276,11 @@ class RenamerClangTidyVisitor return true; } + bool VisitSizeOfPackExpr(SizeOfPackExpr *SizeOfPack) { + Check->addUsage(SizeOfPack->getPack(), SizeOfPack->getPackLoc(), SM); + return true; + } + bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc Loc) { if (const NestedNameSpecifier Spec = Loc.getNestedNameSpecifier(); Spec.getKind() == NestedNameSpecifier::Kind::Namespace) { diff --git a/clang-tools-extra/docs/ReleaseNotes.md b/clang-tools-extra/docs/ReleaseNotes.md index 51dd99256ca69..0134e9f67fa71 100644 --- a/clang-tools-extra/docs/ReleaseNotes.md +++ b/clang-tools-extra/docs/ReleaseNotes.md @@ -191,6 +191,9 @@ infrastructure are described first, followed by tool-specific sections. - Fixed {option}`DefaultHungarianPrefix` being incorrectly diagnosed as an invalid option. + - Fixed invalid fixes when renaming parameter packs used in `sizeof...` + expressions. + - Improved {doc}`readability-named-parameter <clang-tidy/checks/readability/named-parameter>` check by ignoring standard tag types (e.g. `std::in_place_t`, `std::allocator_arg_t`, diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp index f0a72ee31bc21..d00235aa6f28f 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming.cpp @@ -512,6 +512,8 @@ void Global_Fun(TYPE_parameters... PARAMETER_PACK) { // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: invalid case style for global function 'Global_Fun' // CHECK-MESSAGES: :[[@LINE-2]]:36: warning: invalid case style for parameter pack 'PARAMETER_PACK' // CHECK-FIXES: void GlobalFun(typeParameters_t... parameterPack) { + (void)sizeof...(PARAMETER_PACK); +// CHECK-FIXES: (void)sizeof...(parameterPack); global_function(1, 2); // CHECK-FIXES: GlobalFunction(1, 2); FOO_bar = Global_variable; `````````` </details> https://github.com/llvm/llvm-project/pull/219155 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
