[PATCH] D116378: Disable clang-tidy warnings from system macros

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 29 08:40:24 PST 2021


carlosgalvezp created this revision.
carlosgalvezp added reviewers: aaron.ballman, whisperity, salman-javed-nz.
carlosgalvezp added a project: clang-tools-extra.
Herald added subscribers: rnkovacs, kbarton, nemanjai.
carlosgalvezp requested review of this revision.
Herald added a subscriber: cfe-commits.

Currently, it's inconsistent that warnings are disabled if they
come from system headers, unless they come from macros.
Typically a user cannot act upon these warnings coming from
system macros, so clang-tidy should ignore them unless the
user specifically requests warnings from system headers
via the corresponding configuration.

Update the cppcoreguidelines check to use a PP callback
in order to find the problematic macro at macro expansion
time instead. The old AST matcher is kept for Windows
compatibility.

Add unit test that ensures warnings from macros are disabled
when not using the -system-headers flag. Document the change
in the Release Notes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116378

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/file-filter/system/system-header.h
  clang-tools-extra/test/clang-tidy/infrastructure/file-filter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116378.396540.patch
Type: text/x-patch
Size: 8150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211229/4665aec8/attachment-0001.bin>


More information about the cfe-commits mailing list