[PATCH] D68539: [clang-tidy] fix for readability-identifier-naming incorrectly fixes variables which become keywords
Daniel via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 12 10:00:25 PDT 2019
Daniel599 marked an inline comment as done.
Daniel599 added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:868
+ if (CheckNewIdentifier != Idents.end() &&
+ CheckNewIdentifier->second->isKeyword(getLangOpts())) {
+ Failure.FixStatus = ShouldFixStatus::ConflictsWithKeyword;
----------------
Daniel599 wrote:
> aaron.ballman wrote:
> > What if changing it would switch to using a macro instead of a keyword? e.g.,
> > ```
> > #define foo 12
> >
> > void func(int Foo); // Changing Foo to foo would be bad, no?
> > ```
> That's another type of bug, just like the one I found https://bugs.llvm.org/show_bug.cgi?id=43306
> I don't aim on solving all of them in one patch, my patch just fixes keywords.
> Also, I don't think my patch makes the above situation worse.
Regarding your comment about macro name, I can fix it using `IdentifierInfo::hasMacroDefinition`.
Should I fix it in this patch? I`ll add another value to `ShouldFixStatus` and another error message
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68539/new/
https://reviews.llvm.org/D68539
More information about the cfe-commits
mailing list