[PATCH] D16308: clang-tidy Enhance readability-simplify-boolean-expr check to handle implicit conversions of integral types to bool and member pointers

Richard via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 20 13:35:51 PST 2016


LegalizeAdulthood added inline comments.

================
Comment at: docs/clang-tidy/checks/readability-simplify-boolean-expr.rst:59
@@ -56,3 +58,3 @@
 
   4. The conditional return ``if (p) return true; return false;`` has an
      implicit conversion of a pointer to ``bool`` and becomes
----------------
aaron.ballman wrote:
> LegalizeAdulthood wrote:
> > aaron.ballman wrote:
> > > Update for member pointers.
> > Do I really need to explicitly say member pointer as well?  It seems redundant.
> > 
> > I didn't update it because a pointer to a member is a pointer.  When used as an implicit conversion to `bool`, the syntax is no different for a plain pointer than for a member pointer.  If the syntax were different, I could see your point.
> > 
> A pointer to a member is not a pointer according to the language standard, and that's why it may not be a bad idea to call it out explicitly as being supported. From [basic.compound]p3, "Except for pointers to static members, text referring to “pointers” does not apply to pointers to members." I do take your point about the syntax of the implicit conversion being the same, but it would be nice to be explicit about what we support. I would just change it to say "...implicit conversion of a pointer (or pointer to member) to ``bool``..."
Meh.  I don't mind doing that, but the standard gets hyper-anal about how everything is called because without it the standard would be much more ambiguous.  I certainly don't want clang (or clang-tidy) documentation to start reading like the C++ Standard.  In other words, while such specific language is necessary in the standard, I don't think anyone is going to be confused by how I originally worded it.


http://reviews.llvm.org/D16308





More information about the cfe-commits mailing list