Make llvm::function_ref's operator bool explicit
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 26 Mar 2020 20:47:34 +0000 (13:47 -0700)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 27 Mar 2020 03:09:57 +0000 (20:09 -0700)
This can avoid all sorts of mistakes with implicit conversion
(indirectly) to int, etc. I'm quite surprise there aren't any things to
fixup with this - but I guess most uses of function_ref aren't
optional/nullable.

llvm/include/llvm/ADT/STLExtras.h

index 638895e..ad1150b 100644 (file)
@@ -124,7 +124,7 @@ public:
     return callback(callable, std::forward<Params>(params)...);
   }
 
-  operator bool() const { return callback; }
+  explicit operator bool() const { return callback; }
 };
 
 // deleter - Very very very simple method that is used to invoke operator