]> granicus.if.org Git - llvm/commitdiff
Make some operator bools explicit for sanity/safety.
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 11 Jan 2017 19:47:16 +0000 (19:47 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 11 Jan 2017 19:47:16 +0000 (19:47 +0000)
There are a couple left in bool-like containers (BitVector, etc) where
the implicit conversions seem more suitable - though it might be worth
considering explicitifying those too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291694 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/PointerSumType.h
include/llvm/Analysis/LazyCallGraph.h
include/llvm/Support/CommandLine.h

index 005b1c645c935f74f90fce2dc2fe11b8f3ad5880..062544eedf84b0647bbdab160e84cfe731094694 100644 (file)
@@ -94,7 +94,7 @@ public:
     return HelperT::template Lookup<N>::TraitsT::getFromVoidPointer(getImpl());
   }
 
-  operator bool() const { return Value & HelperT::PointerMask; }
+  explicit operator bool() const { return Value & HelperT::PointerMask; }
   bool operator==(const PointerSumType &R) const { return Value == R.Value; }
   bool operator!=(const PointerSumType &R) const { return Value != R.Value; }
   bool operator<(const PointerSumType &R) const { return Value < R.Value; }
index 566e526f89b377960136ef88727001b054bb5a84..bca0aebe2eefa8a1f90fd9eed191e38e88ef1acc 100644 (file)
@@ -148,7 +148,7 @@ public:
     ///
     /// This happens when an edge has been deleted. We leave the edge objects
     /// around but clear them.
-    operator bool() const;
+    explicit operator bool() const;
 
     /// Returnss the \c Kind of the edge.
     Kind getKind() const;
index 204672f88dd9ffde5a3e2820cfee21434ecf1a49..8d4ac81d29429be464145c2474f246a973af2554 100644 (file)
@@ -201,7 +201,7 @@ public:
 
   void reset();
 
-  operator bool() const;
+  explicit operator bool() const;
 
   StringRef getName() const { return Name; }
   StringRef getDescription() const { return Description; }