Made all other "operator bool"s explicit and ensured
that all clients use them explicitly.  This will hopefully
prevent any future confusion where things get cast to types
we don't expect.

<rdar://problem/15146458>

llvm-svn: 191984
diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h
index 10e1ea9..dfeb7b7 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -288,7 +288,7 @@
     }
 
     
-    operator bool () const
+    explicit operator bool () const
     {
         if (m_file)
             return true;
diff --git a/lldb/include/lldb/Host/FileSpec.h b/lldb/include/lldb/Host/FileSpec.h
index f4618c1..dfc6b71 100644
--- a/lldb/include/lldb/Host/FileSpec.h
+++ b/lldb/include/lldb/Host/FileSpec.h
@@ -177,7 +177,7 @@
     ///     A pointer to this object if either the directory or filename
     ///     is valid, NULL otherwise.
     //------------------------------------------------------------------
-    operator bool() const;
+    explicit operator bool() const;
 
     //------------------------------------------------------------------
     /// Logical NOT operator.
diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h
index 2bfab0a..8544fd9 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -42,7 +42,7 @@
             return (*help_callback)();
         }
         
-        operator bool() const
+        explicit operator bool() const
         {
             return (help_callback != NULL);
         }
diff --git a/lldb/include/lldb/Interpreter/OptionValueBoolean.h b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
index 2b935e9..e024f3a 100644
--- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h
+++ b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
@@ -92,7 +92,7 @@
     ///     /b True this object contains a valid namespace decl, \b 
     ///     false otherwise.
     //------------------------------------------------------------------
-    operator bool() const
+    explicit operator bool() const
     {
         return m_current_value;
     }
diff --git a/lldb/include/lldb/Interpreter/PythonDataObjects.h b/lldb/include/lldb/Interpreter/PythonDataObjects.h
index b2c9240..a543181 100644
--- a/lldb/include/lldb/Interpreter/PythonDataObjects.h
+++ b/lldb/include/lldb/Interpreter/PythonDataObjects.h
@@ -105,7 +105,7 @@
         PythonString
         Str ();
         
-        operator bool () const
+        explicit operator bool () const
         {
             return m_py_obj != NULL;
         }
diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
index 6f003da..b529b7b 100644
--- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
@@ -41,7 +41,7 @@
         return m_object;
     }
     
-    operator bool ()
+    explicit operator bool ()
     {
         return m_object != NULL;
     }
diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h
index 2616f57..0a1ec10 100644
--- a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h
+++ b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h
@@ -282,7 +282,7 @@
             Py_XINCREF(m_object);
         }
         
-        operator bool ()
+        explicit operator bool ()
         {
             return m_object && m_object != Py_None;
         }
@@ -351,7 +351,7 @@
     public:
         PythonInputReaderManager (ScriptInterpreterPython *interpreter);
         
-        operator bool()
+        explicit operator bool()
         {
             return m_error;
         }
diff --git a/lldb/include/lldb/Symbol/ClangASTType.h b/lldb/include/lldb/Symbol/ClangASTType.h
index 48c2f45..f0dffe3 100644
--- a/lldb/include/lldb/Symbol/ClangASTType.h
+++ b/lldb/include/lldb/Symbol/ClangASTType.h
@@ -98,7 +98,7 @@
     // Tests
     //----------------------------------------------------------------------
 
-    operator bool () const
+    explicit operator bool () const
     {
         return m_type != NULL && m_ast != NULL;
     }
diff --git a/lldb/include/lldb/Symbol/ClangNamespaceDecl.h b/lldb/include/lldb/Symbol/ClangNamespaceDecl.h
index a0d869c..13a4c00 100644
--- a/lldb/include/lldb/Symbol/ClangNamespaceDecl.h
+++ b/lldb/include/lldb/Symbol/ClangNamespaceDecl.h
@@ -62,7 +62,7 @@
     ///     /b True this object contains a valid namespace decl, \b 
     ///     false otherwise.
     //------------------------------------------------------------------
-    operator bool() const
+    explicit operator bool() const
     {
         return m_ast != NULL && m_namespace_decl != NULL;
     }
diff --git a/lldb/include/lldb/Utility/SharingPtr.h b/lldb/include/lldb/Utility/SharingPtr.h
index 8359c1c..dac34e7 100644
--- a/lldb/include/lldb/Utility/SharingPtr.h
+++ b/lldb/include/lldb/Utility/SharingPtr.h
@@ -714,7 +714,7 @@
         return ptr_; 
     }
     
-    operator bool() const
+    explicit operator bool() const
     {
         return ptr_ != 0;
     }
diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp
index 4413689..fc207d0 100644
--- a/lldb/source/API/SBFileSpec.cpp
+++ b/lldb/source/API/SBFileSpec.cpp
@@ -61,7 +61,7 @@
 bool
 SBFileSpec::IsValid() const
 {
-    return *m_opaque_ap;
+    return m_opaque_ap->operator bool();
 }
 
 bool
diff --git a/lldb/source/API/SBModuleSpec.cpp b/lldb/source/API/SBModuleSpec.cpp
index 654a8ca..17c83ab 100644
--- a/lldb/source/API/SBModuleSpec.cpp
+++ b/lldb/source/API/SBModuleSpec.cpp
@@ -44,7 +44,7 @@
 bool
 SBModuleSpec::IsValid () const
 {
-    return *m_opaque_ap;
+    return m_opaque_ap->operator bool();
 }
 
 void
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index fd54ecc..7cbfaa5 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -98,7 +98,7 @@
             {
                 strm.Indent ();
 
-                bool prefix_with_altname = m_command_options.alternate_name;
+                bool prefix_with_altname = (bool)m_command_options.alternate_name;
                 bool prefix_with_name = !prefix_with_altname;
                 reg_value.Dump(&strm, reg_info, prefix_with_name, prefix_with_altname, m_format_options.GetFormat(), 8);
                 if ((reg_info->encoding == eEncodingUint) || (reg_info->encoding == eEncodingSint))
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index caeed72..8c05bc6 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1900,12 +1900,12 @@
                                                 if (var_name_begin[0] == 'n' || var_name_begin[5] == 'f')
                                                 {
                                                     format_file_spec.GetFilename() = exe_module->GetFileSpec().GetFilename();
-                                                    var_success = format_file_spec;
+                                                    var_success = (bool)format_file_spec;
                                                 }
                                                 else
                                                 {
                                                     format_file_spec = exe_module->GetFileSpec();
-                                                    var_success = format_file_spec;
+                                                    var_success = (bool)format_file_spec;
                                                 }
                                             }
                                         }
@@ -2065,12 +2065,12 @@
                                             if (IsToken (var_name_begin, "basename}"))
                                             {
                                                 format_file_spec.GetFilename() = module->GetFileSpec().GetFilename();
-                                                var_success = format_file_spec;
+                                                var_success = (bool)format_file_spec;
                                             }
                                             else if (IsToken (var_name_begin, "fullpath}"))
                                             {
                                                 format_file_spec = module->GetFileSpec();
-                                                var_success = format_file_spec;
+                                                var_success = (bool)format_file_spec;
                                             }
                                         }
                                     }
@@ -2089,12 +2089,12 @@
                                     if (IsToken (var_name_begin, "basename}"))
                                     {
                                         format_file_spec.GetFilename() = sc->comp_unit->GetFilename();
-                                        var_success = format_file_spec;
+                                        var_success = (bool)format_file_spec;
                                     }
                                     else if (IsToken (var_name_begin, "fullpath}"))
                                     {
                                         format_file_spec = *sc->comp_unit;
-                                        var_success = format_file_spec;
+                                        var_success = (bool)format_file_spec;
                                     }
                                 }
                             }
@@ -2353,12 +2353,12 @@
                                         if (IsToken (var_name_begin, "basename}"))
                                         {
                                             format_file_spec.GetFilename() = sc->line_entry.file.GetFilename();
-                                            var_success = format_file_spec;
+                                            var_success = (bool)format_file_spec;
                                         }
                                         else if (IsToken (var_name_begin, "fullpath}"))
                                         {
                                             format_file_spec = sc->line_entry.file;
-                                            var_success = format_file_spec;
+                                            var_success = (bool)format_file_spec;
                                         }
                                     }
                                     else if (IsTokenWithFormat (var_name_begin, "number", token_format, "%" PRIu64, exe_ctx, sc))
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
index accd344..2be5d90 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
@@ -54,7 +54,7 @@
         }
 
         // Test operator
-        operator bool() const
+        explicit operator bool() const
         {
             return tag != 0;
         }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index f05040b..a4e057c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2625,7 +2625,7 @@
             }
         }
 
-        return clang_type;
+        return (bool)clang_type;
 
     case DW_TAG_enumeration_type:
         clang_type.StartTagDeclarationDefinition ();
@@ -2637,7 +2637,7 @@
             ParseChildEnumerators(sc, clang_type, is_signed, type->GetByteSize(), dwarf_cu, die);
         }
         clang_type.CompleteTagDeclarationDefinition ();
-        return clang_type;
+        return (bool)clang_type;
 
     default:
         assert(false && "not a forward clang type decl!");