lebedev.ri updated this revision to Diff 113226. lebedev.ri added a comment.
Rebased. Repository: rL LLVM https://reviews.llvm.org/D36892 Files: test/clang-tidy/check_clang_tidy.py Index: test/clang-tidy/check_clang_tidy.py =================================================================== --- test/clang-tidy/check_clang_tidy.py +++ test/clang-tidy/check_clang_tidy.py @@ -73,21 +73,23 @@ 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 # avoiding empty lines which could potentially trigger formatting-related # checks. cleaned_test = re.sub('// *CHECK-[A-Z-]*:[^\r\n]*', '//', input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" write_file(original_file_name, cleaned_test) args = ['clang-tidy', temp_file_name, '-fix', '--checks=-*,' + check_name] + \ clang_tidy_extra_args print('Running ' + repr(args) + '...') @@ -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()
Index: test/clang-tidy/check_clang_tidy.py =================================================================== --- test/clang-tidy/check_clang_tidy.py +++ test/clang-tidy/check_clang_tidy.py @@ -73,21 +73,23 @@ 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 # avoiding empty lines which could potentially trigger formatting-related # checks. cleaned_test = re.sub('// *CHECK-[A-Z-]*:[^\r\n]*', '//', input_text) write_file(temp_file_name, cleaned_test) original_file_name = temp_file_name + ".orig" write_file(original_file_name, cleaned_test) args = ['clang-tidy', temp_file_name, '-fix', '--checks=-*,' + check_name] + \ clang_tidy_extra_args print('Running ' + repr(args) + '...') @@ -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()
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits