[PATCH] D36892: [clang-tidy] check_clang_tidy.py: support CHECK-NOTES prefix
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 21 08:08:04 PDT 2017
lebedev.ri updated this revision to Diff 119758.
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
@@ -80,9 +80,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('CHECK-FIXES, CHECK-MESSAGES, or CHECK-NOTES not 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
@@ -143,5 +145,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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36892.119758.patch
Type: text/x-patch
Size: 1472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171021/71675ded/attachment.bin>
More information about the cfe-commits
mailing list