From: David Blaikie Date: Wed, 11 Jan 2017 19:47:16 +0000 (+0000) Subject: Make some operator bools explicit for sanity/safety. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ae69f7de681e29e447a90f028e1e2b2d3e976689;p=llvm Make some operator bools explicit for sanity/safety. 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 --- diff --git a/include/llvm/ADT/PointerSumType.h b/include/llvm/ADT/PointerSumType.h index 005b1c645c9..062544eedf8 100644 --- a/include/llvm/ADT/PointerSumType.h +++ b/include/llvm/ADT/PointerSumType.h @@ -94,7 +94,7 @@ public: return HelperT::template Lookup::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; } diff --git a/include/llvm/Analysis/LazyCallGraph.h b/include/llvm/Analysis/LazyCallGraph.h index 566e526f89b..bca0aebe2ee 100644 --- a/include/llvm/Analysis/LazyCallGraph.h +++ b/include/llvm/Analysis/LazyCallGraph.h @@ -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; diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 204672f88dd..8d4ac81d294 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -201,7 +201,7 @@ public: void reset(); - operator bool() const; + explicit operator bool() const; StringRef getName() const { return Name; } StringRef getDescription() const { return Description; }