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

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 17 16:00:52 PDT 2018


tra marked an inline comment as done.
tra added inline comments.


================
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)
----------------
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.



https://reviews.llvm.org/D52179





More information about the cfe-commits mailing list