summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-10-04 21:35:29 +0000
committerSean Callanan <scallanan@apple.com>2013-10-04 21:35:29 +0000
commit9076c0fffbc1323db78b789f040b30295a3cfcf0 (patch)
treea90d0caeb8a23505699a660f87fb73d4a224b068
parent210791a021a18e3eb60d4a67df6cd452006aa338 (diff)
downloadbcm5719-llvm-9076c0fffbc1323db78b789f040b30295a3cfcf0.tar.gz
bcm5719-llvm-9076c0fffbc1323db78b789f040b30295a3cfcf0.zip
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
-rw-r--r--lldb/include/lldb/Core/ModuleSpec.h2
-rw-r--r--lldb/include/lldb/Host/FileSpec.h2
-rw-r--r--lldb/include/lldb/Interpreter/CommandObject.h2
-rw-r--r--lldb/include/lldb/Interpreter/OptionValueBoolean.h2
-rw-r--r--lldb/include/lldb/Interpreter/PythonDataObjects.h2
-rw-r--r--lldb/include/lldb/Interpreter/ScriptInterpreter.h2
-rw-r--r--lldb/include/lldb/Interpreter/ScriptInterpreterPython.h4
-rw-r--r--lldb/include/lldb/Symbol/ClangASTType.h2
-rw-r--r--lldb/include/lldb/Symbol/ClangNamespaceDecl.h2
-rw-r--r--lldb/include/lldb/Utility/SharingPtr.h2
-rw-r--r--lldb/source/API/SBFileSpec.cpp2
-rw-r--r--lldb/source/API/SBModuleSpec.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectRegister.cpp2
-rw-r--r--lldb/source/Core/Debugger.cpp16
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp4
16 files changed, 25 insertions, 25 deletions
diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h
index 10e1ea9f17a..dfeb7b73ca3 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -288,7 +288,7 @@ public:
}
- 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 f4618c14c4c..dfc6b711ae4 100644
--- a/lldb/include/lldb/Host/FileSpec.h
+++ b/lldb/include/lldb/Host/FileSpec.h
@@ -177,7 +177,7 @@ public:
/// 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 2bfab0a8ecc..8544fd9f9c3 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -42,7 +42,7 @@ public:
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 2b935e9e03e..e024f3a0f3d 100644
--- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h
+++ b/lldb/include/lldb/Interpreter/OptionValueBoolean.h
@@ -92,7 +92,7 @@ public:
/// /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 b2c9240db09..a54318159d1 100644
--- a/lldb/include/lldb/Interpreter/PythonDataObjects.h
+++ b/lldb/include/lldb/Interpreter/PythonDataObjects.h
@@ -105,7 +105,7 @@ namespace lldb_private {
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 6f003daf8c4..b529b7b5f98 100644
--- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h
+++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h
@@ -41,7 +41,7 @@ public:
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 2616f575d20..0a1ec10516e 100644
--- a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h
+++ b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h
@@ -282,7 +282,7 @@ private:
Py_XINCREF(m_object);
}
- operator bool ()
+ explicit operator bool ()
{
return m_object && m_object != Py_None;
}
@@ -351,7 +351,7 @@ private:
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 48c2f45672f..f0dffe38e19 100644
--- a/lldb/include/lldb/Symbol/ClangASTType.h
+++ b/lldb/include/lldb/Symbol/ClangASTType.h
@@ -98,7 +98,7 @@ public:
// 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 a0d869c0782..13a4c0011af 100644
--- a/lldb/include/lldb/Symbol/ClangNamespaceDecl.h
+++ b/lldb/include/lldb/Symbol/ClangNamespaceDecl.h
@@ -62,7 +62,7 @@ public:
/// /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 8359c1caf94..dac34e7e1b4 100644
--- a/lldb/include/lldb/Utility/SharingPtr.h
+++ b/lldb/include/lldb/Utility/SharingPtr.h
@@ -714,7 +714,7 @@ public:
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 4413689501a..fc207d071db 100644
--- a/lldb/source/API/SBFileSpec.cpp
+++ b/lldb/source/API/SBFileSpec.cpp
@@ -61,7 +61,7 @@ SBFileSpec::operator = (const SBFileSpec &rhs)
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 654a8ca6ec8..17c83abb4f2 100644
--- a/lldb/source/API/SBModuleSpec.cpp
+++ b/lldb/source/API/SBModuleSpec.cpp
@@ -44,7 +44,7 @@ SBModuleSpec::~SBModuleSpec ()
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 fd54ecceb9c..7cbfaa5d60f 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -98,7 +98,7 @@ public:
{
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 caeed72e2a7..8c05bc61eef 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1900,12 +1900,12 @@ FormatPromptRecurse
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 @@ FormatPromptRecurse
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 @@ FormatPromptRecurse
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 @@ FormatPromptRecurse
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 accd3446317..2be5d90c37b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
@@ -54,7 +54,7 @@ public:
}
// 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 f05040b70ff..a4e057c85f2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2625,7 +2625,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
}
}
- return clang_type;
+ return (bool)clang_type;
case DW_TAG_enumeration_type:
clang_type.StartTagDeclarationDefinition ();
@@ -2637,7 +2637,7 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (ClangASTType &clang_type)
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!");
OpenPOWER on IntegriCloud