[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:32:48 PDT 2018


tra added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:388
         &NamingStyles) {
+  assert(D && D->getIdentifier() && !D->getName().empty() && !D->isImplicit() &&
+         "Decl must be an explicit identifier with a name.");
----------------
> 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.

Scratch that. It's not worth the trouble, IMO. `D->getDeclName().isIdentifier()` is more verbose and does not buy us anything compared to `D->getIdentifier()` which expresses the intent well enough.



https://reviews.llvm.org/D52179





More information about the cfe-commits mailing list