diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py --- a/clang-tools-extra/clang-tidy/add_new_check.py +++ b/clang-tools-extra/clang-tidy/add_new_check.py @@ -221,7 +221,7 @@ lineMatcher = re.compile('New checks') nextSectionMatcher = re.compile('New check aliases') - checkerMatcher = re.compile('- New :doc:`(.*)') + checkMatcher = re.compile('- New :doc:`(.*)') print('Updating %s...' % filename) with open(filename, 'w') as f: @@ -234,10 +234,10 @@ if not note_added: 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: + match_check = checkMatcher.match(line) + if match_check: + last_check = match_check.group(1) + if last_check > check_name_dashes: add_note_here = True if match_next: diff --git a/clang-tools-extra/clang-tidy/rename_check.py b/clang-tools-extra/clang-tidy/rename_check.py --- a/clang-tools-extra/clang-tidy/rename_check.py +++ b/clang-tools-extra/clang-tidy/rename_check.py @@ -169,21 +169,45 @@ with open(filename, 'r') as f: lines = f.readlines() + lineMatcher = re.compile('Renamed checks') + nextSectionMatcher = re.compile('Improvements to include-fixer') + checkMatcher = re.compile('- The \'(.*)') + print('Updating %s...' % filename) with open(filename, 'wb') 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('Renamed checks', line) + match = lineMatcher.match(line) + match_next = nextSectionMatcher.match(line) + match_check = checkMatcher.match(line) + if match_check: + last_check = match_check.group(1) + if last_check > old_check_name: + 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(""" -- The '%s' check was renamed to :doc:`%s + f.write("""- The '%s' check was renamed to :doc:`%s ` + """ % (old_check_name, new_check_name, new_check_name)) note_added = True diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -128,7 +128,6 @@ Renamed checks ^^^^^^^^^^^^^^ - Improvements to include-fixer -----------------------------