murrayc added inline comments.

================
Comment at: clang-tidy/modernize/ExplicitOperatorBoolCheck.cpp:38
@@ +37,3 @@
+  Finder->addMatcher(
+      cxxConversionDecl(returns(booleanType()), unless(isExplicit()))
+          .bind("operator-bool"),
----------------
alexfh wrote:
> Please merge these two matchers to avoid repeated work. Something along the 
> lines of:
> 
>   cxxConversionDecl(unless(isExplicit()),
>     anyOf(cxxConversionDecl(returns(booleanType())).bind("operator-bool"),
>       cxxConversionDecl(returns(pointerType(pointee(isConstQualified(), 
> voidType()))).bind("operator-void-pointer"))));
It seems that I can't pass cxxConversionDecls to anyOf(). I can pass anyOf to 
cxxConversionDecl, but then I don't see how to bind() to the two kinds of 
declaration separately:

Finder->addMatcher(
       cxxConversionDecl(
           anyOf(returns(booleanType()),
                 returns(pointerType(pointee(isConstQualified(), voidType())))),
           unless(isExplicit())),
       this);

I also wonder if I'll be able to combine them while keeping the check for 
WarnOnOperatorVoidPointer, to avoid unnecessary work when that is disabled. 
(And I still wonder if you even want the check for operator void*.)


https://reviews.llvm.org/D20857



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to