[PATCH] D108560: [clang-tidy] Add support for NOLINTBEGIN ... NOLINTEND comments to suppress clang-tidy warnings over multiple lines

Salman Javed via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 12 20:05:13 PDT 2021


salman-javed-nz updated this revision to Diff 372150.
salman-javed-nz added a comment.

Changes in this latest patch:

- `LineIsMarkedWithNOLINT()`: Moved `NOLINTBEGIN/END` aspects into a separate function.
- `LineIsWithinNOLINTBEGIN()`: A `NOLINTBEGIN/END` region is only considered valid if both the `BEGIN` and `END` markers are present. If the region is malformed, the original warning will be raised.

Discussion points:

- Misuse of `NOLINTBEGIN/END` now always results in the original warning being raised. However, a diagnostic directing the user to location of the mismatched `BEGIN` and `END` markers is not implemented yet.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108560/new/

https://reviews.llvm.org/D108560

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/index.rst
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/error_in_include.inc
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/nolintbeginend/nolint_in_include.inc
  clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108560.372150.patch
Type: text/x-patch
Size: 9304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210913/4cc3f394/attachment-0001.bin>


More information about the cfe-commits mailing list