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

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 10 11:45:18 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348793: [clang-tidy]  insert release notes for new checkers alphabetically (authored by JonasToth, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55508?vs=177538&id=177578#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55508

Files:
  clang-tools-extra/trunk/clang-tidy/add_new_check.py


Index: clang-tools-extra/trunk/clang-tidy/add_new_check.py
===================================================================
--- clang-tools-extra/trunk/clang-tidy/add_new_check.py
+++ clang-tools-extra/trunk/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.177578.patch
Type: text/x-patch
Size: 1721 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181210/c0d8f738/attachment-0001.bin>


More information about the cfe-commits mailing list