This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE342514: [clang-tidy] Replace redundant checks with an
assert(). (authored by tra, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D52179?vs=165841&id=166042#toc
Repository:
rCTE C
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() ||
-Dec
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."
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->isCopyAssi
tra updated this revision to Diff 165841.
tra added a comment.
- Check that D is non-null
https://reviews.llvm.org/D52179
Files:
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
Index: clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
=
aaron.ballman added inline comments.
Comment at:
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp:388
&NamingStyles) {
+ assert(D->getIdentifier() && !D->getName().empty() && !D->isImplicit() &&
+ "Decl must be an explicit identifier with a na
tra added a comment.
In https://reviews.llvm.org/D52179#1237194, @JonasToth wrote:
> Is the condition for this assertion checked beforehand or could this create
> runtime failures?
It's checked by the (only) caller of the function on line 791:
if (const auto *Decl = Result.Nodes.getNodeAs
JonasToth added a comment.
Is the condition for this assertion checked beforehand or could this create
runtime failures?
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D52179
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
h
tra created this revision.
tra added reviewers: alexfh, rsmith.
Herald added subscribers: bixia, xazax.hun, jlebar, sanjoy.
findStyleKind is only called if D is an explicit identifier with a name,
so the checks for operators will never return true. The explicit assert()
enforces this invariant.