carlosgalvezp updated this revision to Diff 489271. carlosgalvezp added a comment.
Update release notes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141769/new/ https://reviews.llvm.org/D141769 Files: clang-tools-extra/clang-tidy/add_new_check.py clang-tools-extra/clang-tidy/rename_check.py clang-tools-extra/docs/ReleaseNotes.rst Index: clang-tools-extra/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/docs/ReleaseNotes.rst +++ clang-tools-extra/docs/ReleaseNotes.rst @@ -106,6 +106,8 @@ which is no longer in use. The option will be fully removed in :program:`clang-tidy` version 18. +- Use C++17 nested namespaces in `add_new_check.py` and `rename_check.py`. + New checks ^^^^^^^^^^ Index: clang-tools-extra/clang-tidy/rename_check.py =================================================================== --- clang-tools-extra/clang-tidy/rename_check.py +++ clang-tools-extra/clang-tidy/rename_check.py @@ -308,8 +308,13 @@ for filename in check_implementation_files: # Move check implementation to the directory of the new module. filename = fileRename(filename, old_module_path, new_module_path) + # TODO: remove below replacement when all clang-tidy checks have been + # updated with C++17 nested namespaces. replaceInFileRegex(filename, 'namespace ' + old_module + '[^ \n]*', 'namespace ' + new_namespace) + replaceInFileRegex(filename, + 'namespace clang::tidy::' + old_module + '[^ \n]*', + 'namespace clang::tidy::' + new_namespace) if (args.old_check_name == args.new_check_name): return Index: clang-tools-extra/clang-tidy/add_new_check.py =================================================================== --- clang-tools-extra/clang-tidy/add_new_check.py +++ clang-tools-extra/clang-tidy/add_new_check.py @@ -77,9 +77,7 @@ #include "../ClangTidyCheck.h" -namespace clang { -namespace tidy { -namespace %(namespace)s { +namespace clang::tidy::%(namespace)s { /// FIXME: Write a short description. /// @@ -93,9 +91,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace %(namespace)s -} // namespace tidy -} // namespace clang +} // namespace clang::tidy::%(namespace)s #endif // %(header_guard)s """ % {'header_guard': header_guard, @@ -129,9 +125,7 @@ using namespace clang::ast_matchers; -namespace clang { -namespace tidy { -namespace %(namespace)s { +namespace clang::tidy::%(namespace)s { void %(check_name)s::registerMatchers(MatchFinder *Finder) { // FIXME: Add matchers. @@ -149,9 +143,7 @@ << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_"); } -} // namespace %(namespace)s -} // namespace tidy -} // namespace clang +} // namespace clang::tidy::%(namespace)s """ % {'check_name': check_name_camel, 'module': module, 'namespace': namespace})
Index: clang-tools-extra/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/docs/ReleaseNotes.rst +++ clang-tools-extra/docs/ReleaseNotes.rst @@ -106,6 +106,8 @@ which is no longer in use. The option will be fully removed in :program:`clang-tidy` version 18. +- Use C++17 nested namespaces in `add_new_check.py` and `rename_check.py`. + New checks ^^^^^^^^^^ Index: clang-tools-extra/clang-tidy/rename_check.py =================================================================== --- clang-tools-extra/clang-tidy/rename_check.py +++ clang-tools-extra/clang-tidy/rename_check.py @@ -308,8 +308,13 @@ for filename in check_implementation_files: # Move check implementation to the directory of the new module. filename = fileRename(filename, old_module_path, new_module_path) + # TODO: remove below replacement when all clang-tidy checks have been + # updated with C++17 nested namespaces. replaceInFileRegex(filename, 'namespace ' + old_module + '[^ \n]*', 'namespace ' + new_namespace) + replaceInFileRegex(filename, + 'namespace clang::tidy::' + old_module + '[^ \n]*', + 'namespace clang::tidy::' + new_namespace) if (args.old_check_name == args.new_check_name): return Index: clang-tools-extra/clang-tidy/add_new_check.py =================================================================== --- clang-tools-extra/clang-tidy/add_new_check.py +++ clang-tools-extra/clang-tidy/add_new_check.py @@ -77,9 +77,7 @@ #include "../ClangTidyCheck.h" -namespace clang { -namespace tidy { -namespace %(namespace)s { +namespace clang::tidy::%(namespace)s { /// FIXME: Write a short description. /// @@ -93,9 +91,7 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; -} // namespace %(namespace)s -} // namespace tidy -} // namespace clang +} // namespace clang::tidy::%(namespace)s #endif // %(header_guard)s """ % {'header_guard': header_guard, @@ -129,9 +125,7 @@ using namespace clang::ast_matchers; -namespace clang { -namespace tidy { -namespace %(namespace)s { +namespace clang::tidy::%(namespace)s { void %(check_name)s::registerMatchers(MatchFinder *Finder) { // FIXME: Add matchers. @@ -149,9 +143,7 @@ << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_"); } -} // namespace %(namespace)s -} // namespace tidy -} // namespace clang +} // namespace clang::tidy::%(namespace)s """ % {'check_name': check_name_camel, 'module': module, 'namespace': namespace})
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits