Author: Balazs Benics Date: 2022-05-21T22:16:55+02:00 New Revision: ecf5924eb4c4111bbab62425aca85866bb94b679
URL: https://github.com/llvm/llvm-project/commit/ecf5924eb4c4111bbab62425aca85866bb94b679 DIFF: https://github.com/llvm/llvm-project/commit/ecf5924eb4c4111bbab62425aca85866bb94b679.diff LOG: [clang-tidy] Add a useful note about -std=c++11-or-later I and @whisperity spent some time debugging a LIT test case using the `-std=c++11-or-later` `check_clang_tidy.py` flag when the test had fixits. It turns out if the test wants to report a diagnostic into a header file AND into the test file as well, one needs to first copy the header somewhere under the build directory. It needs to be copied since `clang-tidy` sorts the reports into alphabetical order, thus to have a deterministic order relative to the diagnostic in the header AND the diagnostic in the test cpp file. There is more to this story. The `-std=c++11-or-later` turns out executes the test with multiple `-std=XX` version substitution, and each execution will also have the `-fix` tidy parameter. This means that the freshly copied header file I stated in the previous paragraph gets fixed up and the very next tidy execution will fail miserably. Following @whisperity's advice, I'm leaving a reminder about such //shared// state in the related doc comment. Reviewed By: LegalizeAdulthood Differential Revision: https://reviews.llvm.org/D125771 Added: Modified: clang-tools-extra/test/clang-tidy/check_clang_tidy.py Removed: ################################################################################ diff --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py index d764f20ef2ecc..e6a4a8e505492 100755 --- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py +++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py @@ -19,11 +19,17 @@ [-assume-filename=<file-with-source-extension>] \ [-check-suffix=<comma-separated-file-check-suffixes>] \ [-check-suffixes=<comma-separated-file-check-suffixes>] \ + [-std=c++(98|11|14|17|20)[-or-later]] \ <source-file> <check-name> <temp-file> \ -- [optional clang-tidy arguments] Example: // RUN: %check_clang_tidy %s llvm-include-order %t -- -- -isystem %S/Inputs + +Notes: + -std=c++(98|11|14|17|20)-or-later: + This flag will cause multiple runs within the same check_clang_tidy + execution. Make sure you don't have shared state across these runs. """ import argparse _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits