[PATCH] D33841: [clang-tidy] redundant 'extern' keyword check
Daniel Kolozsvari via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 09:59:38 PDT 2019
koldaniel marked an inline comment as done.
koldaniel added inline comments.
================
Comment at: clang-tidy/readability/RedundantExternCheck.cpp:30
+
+ if (FD->getStorageClass() != SC_Extern)
+ return;
----------------
lebedev.ri wrote:
> Can you do that in `registerMatchers()`?
The only way I found for that is to use the matcher `hasExternalFormalLinkage`, but the problem with it is that now the checker warns not only for the redundant `extern` usage, but for the unnecessary too - in the latter case the linkage is internal, and I think by checking the storage class we can determine whether the `extern` keyword has been used or not.
================
Comment at: clang-tidy/readability/RedundantExternCheck.cpp:43-44
+
+ if (FD->getBeginLoc().isMacroID())
+ return;
+
----------------
lebedev.ri wrote:
> Similarly, do this in `registerMatchers()`
Could you please help me how could I achieve that? I did not find any matchers which match for macros.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D33841/new/
https://reviews.llvm.org/D33841
More information about the llvm-commits
mailing list