[PATCH] D52179: [clang-tidy] Replace redundant checks with an assert().

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 18 05:07:38 PDT 2018


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!



================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:551-552
     if (Decl->isMain() || !Decl->isUserProvided() ||
-        Decl->isUsualDeallocationFunction() ||
-        Decl->isCopyAssignmentOperator() || Decl->isMoveAssignmentOperator() ||
         Decl->size_overridden_methods() > 0)
----------------
tra wrote:
> aaron.ballman wrote:
> > Why are these being removed?
> D51808 changes signature of isUsualDeallocationFunction(), which made me update the code here, which lead to @rsmith suggesting that this change is redundant and could use cleaning up, which led to this change.
> 
> Any Decl which would return true for isUsualDeallocationFunction()  or for is*Operator(), will always return nullptr for getIdentifier() because D->getName().isIdentifier() would be false.
> 
> Speaking of which, the result of getIdentifier() is never used, so the check should probably be D->isIdentifier() both in this function and in the caller.
> 
Ah, thank you for the explanation -- that makes sense.


https://reviews.llvm.org/D52179





More information about the cfe-commits mailing list