[all-commits] [llvm/llvm-project] 670de1: Disable clang-tidy warnings from system macros
Carlos Galvez via All-commits
all-commits at lists.llvm.org
Thu Jan 6 12:28:21 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 670de10f9deaa83f4d1db6e793c74cbfd18c65c1
https://github.com/llvm/llvm-project/commit/670de10f9deaa83f4d1db6e793c74cbfd18c65c1
Author: Carlos Galvez <carlosgalvezp at gmail.com>
Date: 2022-01-06 (Thu, 06 Jan 2022)
Changed paths:
M clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
M clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
M clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.h
M clang-tools-extra/docs/ReleaseNotes.rst
M clang-tools-extra/test/clang-tidy/infrastructure/Inputs/file-filter/system/system-header.h
M clang-tools-extra/test/clang-tidy/infrastructure/file-filter.cpp
Log Message:
-----------
Disable clang-tidy warnings from system macros
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.
This change broke the ProTypeVarargCheck check, because it
was checking for the usage of va_arg indirectly, expanding it
(it's a system macro) to detect the usage of __builtin_va_arg.
The check has been fixed by checking directly what the rule
is about: "do not use va_arg", by adding a PP callback that
checks if any macro with name "va_arg" is expanded. The old
AST matcher is still kept for compatibility with Windows.
Add unit test that ensures warnings from macros are disabled
when not using the -system-headers flag. Document the change
in the Release Notes.
Differential Revision: https://reviews.llvm.org/D116378
More information about the All-commits
mailing list