[PATCH] D20857: [clang-tidy] Add modernize-explicit-operator-bool check.

Murray Cumming via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 05:47:07 PDT 2016


murrayc added inline comments.

================
Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:27
@@ +26,3 @@
+  Finder->addMatcher(cxxConversionDecl(returns(pointerType(pointee(
+                                           isConstQualified(), voidType()))),
+                                       unless(isExplicit()))
----------------
etienneb wrote:
> I'm curious, why: isConstQualified() ?
> I'm probably missing something.
This is a workaround for the lack of explicit operator bool before C++:
  operator const void*() const;
but this would be unlikely to be meant the same way, partly because the constness would be awkward:
  operator void*() const;



================
Comment at: clang-tidy/modernize/OperatorVoidPointerCheck.cpp:40
@@ +39,3 @@
+
+  // FIXME: This tries to change the type and add explicit, but
+  // MatchedDecl->getTypeSpecStartLoc() gets the start of void, not the start
----------------
etienneb wrote:
> The FIXME only apply to the fixtit statements.
>   << FIxItHint(...)
> 
> you can still output a diag message.
Yes. I do that in the previous lines.


http://reviews.llvm.org/D20857





More information about the cfe-commits mailing list