[PATCH] D116386: [clang-tidy] Narrow cppguidelines-macro-usage to actual constants
Richard via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 29 17:46:46 PST 2021
LegalizeAdulthood created this revision.
LegalizeAdulthood added a reviewer: alexfh.
Herald added subscribers: carlosgalvezp, kbarton, xazax.hun, nemanjai.
LegalizeAdulthood requested review of this revision.
Herald added a project: clang-tools-extra.
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.
Fixes #39945
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116386
Files:
clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116386.396584.patch
Type: text/x-patch
Size: 4664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211230/00fbae5d/attachment.bin>
More information about the cfe-commits
mailing list