Index: test/clang-tidy/check_clang_tidy.py =================================================================== --- test/clang-tidy/check_clang_tidy.py +++ test/clang-tidy/check_clang_tidy.py @@ -73,9 +73,11 @@ has_check_fixes = input_text.find('CHECK-FIXES') >= 0 has_check_messages = input_text.find('CHECK-MESSAGES') >= 0 + has_check_notes = input_text.find('CHECK-NOTES') >= 0 - if not has_check_fixes and not has_check_messages: - sys.exit('Neither CHECK-FIXES nor CHECK-MESSAGES found in the input') + if not has_check_fixes and not has_check_messages and not has_check_notes: + sys.exit('Neither CHECK-FIXES nor CHECK-MESSAGES ' + 'nor CHECK-NOTES found in the input') # Remove the contents of the CHECK lines to avoid CHECKs matching on # themselves. We need to keep the comments to preserve line numbers while @@ -136,5 +138,18 @@ print('FileCheck failed:\n' + e.output.decode()) raise + if has_check_notes: + messages_file = temp_file_name + '.msg' + write_file(messages_file, clang_tidy_output) + try: + subprocess.check_output( + ['FileCheck', '-input-file=' + messages_file, input_file_name, + '-check-prefix=CHECK-NOTES', + '-implicit-check-not={{note|warning|error}}:'], + stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as e: + print('FileCheck failed:\n' + e.output.decode()) + raise + if __name__ == '__main__': main()