[PATCH] D123349: [clang-tidy] Deal with keyword tokens in preprocessor conditions
Richard via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 8 13:49:17 PDT 2022
LegalizeAdulthood added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/modernize/MacroToEnumCheck.cpp:281
+inline StringRef getTokenName(const Token &Tok) {
+ return Tok.is(tok::raw_identifier) ? Tok.getRawIdentifier()
----------------
aaron.ballman wrote:
> LegalizeAdulthood wrote:
> > njames93 wrote:
> > > inline is pretty redundant here. Did you mean to make this static?
> > ReSharper flagged this as redundant as well, but I'm not sure I understand why inline is redundant here.
> >
> > Static is definitely redundant because this is all inside an anonymous namespace block.
> > ReSharper flagged this as redundant as well, but I'm not sure I understand why inline is redundant here.
>
> `inline` has no real semantic effect there -- it's an internal function so the optimizer is free to inline it at its whim if it wants.
>
> > Static is definitely redundant because this is all inside an anonymous namespace block.
>
> We should correct that in a follow-up NFC commit, that's something we recommend against in the style guide (https://llvm.org/docs/CodingStandards.html#anonymous-namespaces) for exactly this scenario (it's not immediately clear when reading the declaration that it already had internal linkage).
I don't mind fixing it now since it's a new function
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123349/new/
https://reviews.llvm.org/D123349
More information about the cfe-commits
mailing list