[all-commits] [llvm/llvm-project] d83ecd: [clang-tidy] Narrow cppguidelines-macro-usage to a...
Richard Thomson via All-commits
all-commits at lists.llvm.org
Wed Jan 19 11:29:19 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d83ecd77cc0f16cb5fbabe03d37829893ac8b56d
https://github.com/llvm/llvm-project/commit/d83ecd77cc0f16cb5fbabe03d37829893ac8b56d
Author: Richard <legalize at xmission.com>
Date: 2022-01-19 (Wed, 19 Jan 2022)
Changed paths:
M clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp
M clang-tools-extra/docs/ReleaseNotes.rst
M clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-macro-usage.rst
M clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage.cpp
Log Message:
-----------
[clang-tidy] Narrow cppguidelines-macro-usage to actual constants
Previously, any macro that didn't look like a varargs macro
or a function style macro was reported with a warning that
it should be replaced with a constexpr const declaration.
This is only reasonable when the macro body contains constants
and not expansions like ",", "[[noreturn]]", "__declspec(xxx)",
etc.
So instead of always issuing a warning about every macro that
doesn't look like a varargs or function style macro, examine the
tokens in the macro and only warn about the macro if it contains
only comment and constant tokens.
Differential Revision: https://reviews.llvm.org/D116386
Fixes #39945
More information about the All-commits
mailing list