[clang-tools-extra] r341039 - [clang-tidy] fix check_clang_tidy to forbid mixing of CHECK-NOTES and CHECK-MESSAGES

Jonas Toth via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 30 01:44:27 PDT 2018


Author: jonastoth
Date: Thu Aug 30 01:44:27 2018
New Revision: 341039

URL: http://llvm.org/viewvc/llvm-project?rev=341039&view=rev
Log:
[clang-tidy] fix check_clang_tidy to forbid mixing of CHECK-NOTES and CHECK-MESSAGES

Summary:
The check_clang_tidy.py script would allow mixing of `CHECK-NOTES` and `CHECK-MESSAGES` but running `FileCheck` for that would implicitly fail, because `CHECK-NOTES` bails out if there is a warning.

That means a clang-tidy test can not mix these constructs to check warnings with `CHECK-MESSAGES` and notes with `CHECK-NOTES`. The script gives now a clear error if that happens.

Reviewers: alexfh, aaron.ballman, lebedev.ri, hokein

Reviewed By: lebedev.ri

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D51381

Modified:
    clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py

Modified: clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py?rev=341039&r1=341038&r2=341039&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py (original)
+++ clang-tools-extra/trunk/test/clang-tidy/check_clang_tidy.py Thu Aug 30 01:44:27 2018
@@ -98,6 +98,9 @@ def main():
     sys.exit('%s, %s or %s not found in the input' % (check_fixes_prefix,
              check_messages_prefix, check_notes_prefix) )
 
+  if has_check_notes and has_check_messages:
+    sys.exit('Please use either CHECK-NOTES or CHECK-MESSAGES but not both')
+
   # 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




More information about the cfe-commits mailing list