[PATCH] D13440: [clang-tidy] Python script for easy check rename

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 12:34:23 PDT 2015


alexfh added inline comments.

================
Comment at: clang-tidy/rename_check.py:3
@@ +2,3 @@
+#
+#===- add_new_check.py - clang-tidy check generator ----------*- python -*--===#
+#
----------------
Please update the script name and description in the comment.

================
Comment at: clang-tidy/rename_check.py:18
@@ +17,3 @@
+def replaceInFile(fileName, sFrom, sTo):
+    txt = None
+    with open(fileName, "r") as f:
----------------
Please use 2 spaces for indentation.

================
Comment at: clang-tidy/rename_check.py:39
@@ +38,3 @@
+  if len(sys.argv) != 4:
+    print('Usage: rename_check.py <module> <check>, e.g.\n')
+    print('rename_check.py misc awesome-functions new-awesome-function\n')
----------------
New check name is missing.

================
Comment at: clang-tidy/rename_check.py:52
@@ +51,3 @@
+  clang_tidy_path = os.path.dirname(sys.argv[0])
+  module_path = os.path.join(clang_tidy_path, module)
+
----------------
This should be updated similarly to the add_new_check.py change in http://reviews.llvm.org/D13313.

================
Comment at: clang-tidy/rename_check.py:64
@@ +63,3 @@
+      replaceInFile(filename, header_guard_old, header_guard_new)
+      replaceInFile(filename, check_name, check_name_new)
+      replaceInFile(filename, check_name_camel, check_name_new_camel)
----------------
Would be nice, if this script took care of updating the file comments in .h and .cpp files including it's padding with dashes, e.g.:

  //===--- ProTypeReinterpretCastCheck.cpp - clang-tidy--------------------------===//



Repository:
  rL LLVM

http://reviews.llvm.org/D13440





More information about the cfe-commits mailing list