[PATCH] D116386: [clang-tidy] Narrow cppguidelines-macro-usage to actual constants
Richard via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 30 04:06:43 PST 2021
LegalizeAdulthood added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/MacroUsageCheck.cpp:83-105
+bool isConstantToken(const MacroDirective *MD) {
+ for (const auto &Token : MD->getMacroInfo()->tokens()) {
+ switch (Token.getKind()) {
+ case tok::comment:
+ case tok::numeric_constant:
+ case tok::char_constant:
+ case tok::wide_char_constant:
----------------
In the spirit of "avoid raw loops", would this be clearer expressed as std::all_of and the switch/case provided as a lambda?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116386/new/
https://reviews.llvm.org/D116386
More information about the cfe-commits
mailing list