[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
Mon Aug 23 08:41:21 PDT 2021


salman-javed-nz created this revision.
salman-javed-nz added reviewers: alexfh, aaron.ballman, njames93.
salman-javed-nz added a project: clang-tools-extra.
Herald added subscribers: arphaman, xazax.hun.
salman-javed-nz requested review of this revision.

Add support for `NOLINTBEGIN` ... `NOLINTEND` comments to suppress clang-tidy warnings over multiple lines. All lines between the "begin" and "end" markers are suppressed.
Example:

  // NOLINTBEGIN(some-check)
  // <Code with warnings to be suppressed, line 1>
  // <Code with warnings to be suppressed, line 2>
  // <Code with warnings to be suppressed, line 3>
  // NOLINTEND(some-check)

Follows similar syntax as the `NOLINT` and `NOLINTNEXTLINE` comments that are already implemented, i.e. allows multiple checks to be provided in parentheses; suppresses all checks if the parentheses are omitted, etc.


Repository:
  rG LLVM Github Monorepo

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/nolintbeginend.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108560.368114.patch
Type: text/x-patch
Size: 7039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210823/2e22eb76/attachment.bin>


More information about the cfe-commits mailing list