[PATCH] D55508: [clang-tidy] insert release notes for new checkers alphabetically

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 10 09:17:55 PST 2018


MyDeveloperDay updated this revision to Diff 177538.
MyDeveloperDay added a comment.

Fix review comments


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

https://reviews.llvm.org/D55508

Files:
  clang-tidy/add_new_check.py


Index: clang-tidy/add_new_check.py
===================================================================
--- clang-tidy/add_new_check.py
+++ clang-tidy/add_new_check.py
@@ -200,23 +200,47 @@
   with open(filename, 'r') as f:
     lines = f.readlines()
 
+  lineMatcher = re.compile('Improvements to clang-tidy')
+  nextSectionMatcher = re.compile('Improvements to include-fixer')
+  checkerMatcher = re.compile('- New :doc:`(.*)')
+
   print('Updating %s...' % filename)
   with open(filename, 'w') as f:
     note_added = False
     header_found = False
+    next_header_found = False
+    add_note_here = False
 
     for line in lines:
       if not note_added:
-        match = re.search('Improvements to clang-tidy', line)
+        match = lineMatcher.match(line)
+        match_next = nextSectionMatcher.match(line)
+        match_checker = checkerMatcher.match(line)
+        if match_checker:
+          last_checker = match_checker.group(1)
+          if last_checker > check_name_dashes:
+            add_note_here = True
+
+        if match_next:
+          next_header_found = True
+          add_note_here = True
+
         if match:
           header_found = True
-        elif header_found:
+          f.write(line)
+          continue
+
+        if line.startswith('----'):
+          f.write(line)
+          continue
+
+        if header_found and add_note_here:
           if not line.startswith('----'):
-            f.write("""
-- New :doc:`%s
+            f.write("""- New :doc:`%s
   <clang-tidy/checks/%s>` check.
 
   FIXME: add release notes.
+
 """ % (check_name_dashes, check_name_dashes))
             note_added = True
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55508.177538.patch
Type: text/x-patch
Size: 1649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181210/13b208c3/attachment.bin>


More information about the cfe-commits mailing list