[PATCH] D141463: [clang-tidy] Improve rename_check.py

Chris Cotter via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 11 05:34:36 PST 2023


ccotter updated this revision to Diff 488169.
ccotter added a comment.

- revert git changes


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141463/new/

https://reviews.llvm.org/D141463

Files:
  clang-tools-extra/clang-tidy/rename_check.py


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
@@ -93,12 +93,9 @@
 
 
 def getListOfFiles(clang_tidy_path):
-  files = glob.glob(os.path.join(clang_tidy_path, '*'))
-  for dirname in files:
-    if os.path.isdir(dirname):
-      files += glob.glob(os.path.join(dirname, '*'))
+  files = glob.glob(os.path.join(clang_tidy_path, '**'), recursive=True)
   files += glob.glob(os.path.join(clang_tidy_path, '..', 'test',
-                                  'clang-tidy', '*'))
+                                  'clang-tidy', 'checkers', '**'), recursive=True)
   files += glob.glob(os.path.join(clang_tidy_path, '..', 'docs',
                                   'clang-tidy', 'checks', '*'))
   return [filename for filename in files if os.path.isfile(filename)]
@@ -273,10 +270,12 @@
     deleteMatchingLines(os.path.join(old_module_path, modulecpp),
                       '\\b' + check_name_camel + '|\\b' + args.old_check_name)
 
+  old_check_filename = '-'.join(args.old_check_name.split('-')[1:])
+  new_check_filename = '-'.join(args.new_check_name.split('-')[1:])
+
   for filename in getListOfFiles(clang_tidy_path):
     originalName = filename
-    filename = fileRename(filename, args.old_check_name,
-                          args.new_check_name)
+    filename = fileRename(filename, old_check_filename, new_check_filename)
     filename = fileRename(filename, check_name_camel, new_check_name_camel)
     replaceInFile(filename, generateCommentLineHeader(originalName),
                   generateCommentLineHeader(filename))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141463.488169.patch
Type: text/x-patch
Size: 1706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230111/77b3ad3e/attachment.bin>


More information about the cfe-commits mailing list