[all-commits] [llvm/llvm-project] ecf592: [clang-tidy] Add a useful note about -std=c++11-or...

Balazs Benics via All-commits all-commits at lists.llvm.org
Sat May 21 13:17:44 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ecf5924eb4c4111bbab62425aca85866bb94b679
      https://github.com/llvm/llvm-project/commit/ecf5924eb4c4111bbab62425aca85866bb94b679
  Author: Balazs Benics <balazs.benics at sigmatechnology.se>
  Date:   2022-05-21 (Sat, 21 May 2022)

  Changed paths:
    M clang-tools-extra/test/clang-tidy/check_clang_tidy.py

  Log Message:
  -----------
  [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




More information about the All-commits mailing list