[PATCH] D124316: [clang-tidy] Modernize-macro-to-enum should skip macros used in other macros
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 26 08:09:11 PDT 2022
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM with a few small nits.
================
Comment at: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp:230
+ void rememberExpressionName(const Token &Tok);
+ void rememberExpressionTokens(const ArrayRef<Token> &MacroTokens);
void invalidateExpressionNames();
----------------
`ArrayRef` is intended to be cheap in the same way as `StringRef`, so we don't pass const references for it.
================
Comment at: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp:316-318
+ for (Token Tok : MacroTokens)
+ if (Tok.isAnyIdentifier())
+ rememberExpressionName(Tok);
----------------
I know the coding guide says we can elide braces there, but because the for loop substatement is multiple lines, I think braces help readability.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124316/new/
https://reviews.llvm.org/D124316
More information about the cfe-commits
mailing list