[PATCH] D22507: Clang-tidy - Enum misuse check
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 13 06:53:36 PST 2016
alexfh added inline comments.
Comment at: clang-tidy/misc/SuspiciousEnumUsageCheck.cpp:155
+ if (EnumDec->enumerator_begin() == EnumDec->enumerator_end() ||
+ OtherEnumDec->enumerator_begin() == OtherEnumDec->enumerator_end())
> alexfh wrote:
> > Why?
> Because the hasDisjointValueRange function could not decide the values properly. So in case of an empty Enum it would not make sense. Fortunately we know that the empty case should not be reported so used early return on this.
> That is why this is needed if we want a deterministic check.
BTW, this might make sense to be explained in the comment in the code itself (code review comments are bad means of documenting code).
More information about the cfe-commits