[clang-tools-extra] r307787 - [clang-tidy] add_new_check.py updates ReleaseNotes.rst now
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 12 06:13:41 PDT 2017
Author: alexfh
Date: Wed Jul 12 06:13:41 2017
New Revision: 307787
URL: http://llvm.org/viewvc/llvm-project?rev=307787&view=rev
Log:
[clang-tidy] add_new_check.py updates ReleaseNotes.rst now
Modified:
clang-tools-extra/trunk/clang-tidy/add_new_check.py
Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/add_new_check.py?rev=307787&r1=307786&r2=307787&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/add_new_check.py (original)
+++ clang-tools-extra/trunk/clang-tidy/add_new_check.py Wed Jul 12 06:13:41 2017
@@ -189,6 +189,37 @@ def adapt_module(module_path, module, ch
f.write(line)
+# Adds a release notes entry.
+def add_release_notes(module_path, module, check_name):
+ check_name_dashes = module + '-' + check_name
+ filename = os.path.normpath(os.path.join(module_path,
+ '../../docs/ReleaseNotes.rst'))
+ with open(filename, 'r') as f:
+ lines = f.readlines()
+
+ print('Updating %s...' % filename)
+ with open(filename, 'wb') as f:
+ note_added = False
+ header_found = False
+
+ for line in lines:
+ if not note_added:
+ match = re.search('Improvements to clang-tidy', line)
+ if match:
+ header_found = True
+ elif header_found:
+ if not line.startswith('----'):
+ f.write("""
+- New `%s
+ <http://clang.llvm.org/extra/clang-tidy/checks/%s.html>`_ check
+
+ FIXME: add release notes.
+""" % (check_name_dashes, check_name_dashes))
+ note_added = True
+
+ f.write(line)
+
+
# Adds a test for the check.
def write_test(module_path, module, check_name):
check_name_dashes = module + '-' + check_name
@@ -300,6 +331,7 @@ documentation files."""
write_header(module_path, module, check_name, check_name_camel)
write_implementation(module_path, module, check_name_camel)
adapt_module(module_path, module, check_name, check_name_camel)
+ add_release_notes(module_path, module, check_name)
write_test(module_path, module, check_name)
write_docs(module_path, module, check_name)
update_checks_list(clang_tidy_path)
More information about the cfe-commits
mailing list