[Lldb-commits] [lldb] r161559 - in /lldb/trunk/source: Commands/ Core/ Expression/ Interpreter/ Plugins/DynamicLoader/MacOSX-DYLD/ Plugins/ObjectFile/Mach-O/ Plugins/Process/Utility/ Plugins/SymbolFile/DWARF/ Target/

Sean Callanan scallanan at apple.com
Wed Aug 8 17:50:26 PDT 2012


Author: spyffe
Date: Wed Aug  8 19:50:26 2012
New Revision: 161559

URL: http://llvm.org/viewvc/llvm-project?rev=161559&view=rev
Log:
Removed explicit NULL checks for shared pointers
and instead made us use implicit casts to bool.
This generated a warning in C++11.

<rdar://problem/11930775>

Modified:
    lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Expression/ClangExpressionParser.cpp
    lldb/trunk/source/Expression/ClangFunction.cpp
    lldb/trunk/source/Expression/ClangUserExpression.cpp
    lldb/trunk/source/Expression/IRInterpreter.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
    lldb/trunk/source/Target/ThreadPlanStepUntil.cpp

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Wed Aug  8 19:50:26 2012
@@ -245,7 +245,7 @@
     const char *plugin_name = m_options.GetPluginName ();
     DisassemblerSP disassembler = Disassembler::FindPlugin(m_options.arch, plugin_name);
 
-    if (disassembler == NULL)
+    if (!disassembler)
     {
         if (plugin_name)
             result.AppendErrorWithFormat ("Unable to find Disassembler plug-in named '%s' that supports the '%s' architecture.\n", 

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed Aug  8 19:50:26 2012
@@ -2327,7 +2327,7 @@
     Log::Callbacks log_callbacks;
 
     StreamSP log_stream_sp;
-    if (m_log_callback_stream_sp != NULL)
+    if (m_log_callback_stream_sp)
     {
         log_stream_sp = m_log_callback_stream_sp;
         // For now when using the callback mode you always get thread & timestamp.

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Aug  8 19:50:26 2012
@@ -2657,7 +2657,7 @@
                                                               err);
             
             // If we found a variable in scope, no need to pull up function names
-            if (err.Success() && var != NULL)
+            if (err.Success() && var)
             {
                 AddOneVariable(context, var, valobj, current_id);
                 context.m_found.variable = true;

Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Wed Aug  8 19:50:26 2012
@@ -756,7 +756,7 @@
     
     lldb::DisassemblerSP disassembler = Disassembler::FindPlugin(arch, NULL);
     
-    if (disassembler == NULL)
+    if (!disassembler)
     {
         ret.SetErrorToGenericError();
         ret.SetErrorStringWithFormat("Unable to find disassembler plug-in for %s architecture.", arch.GetArchitectureName());

Modified: lldb/trunk/source/Expression/ClangFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangFunction.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangFunction.cpp (original)
+++ lldb/trunk/source/Expression/ClangFunction.cpp Wed Aug  8 19:50:26 2012
@@ -499,7 +499,7 @@
                                                                                  stop_others, 
                                                                                  discard_on_error, 
                                                                                  this_arg));
-    if (call_plan_sp == NULL)
+    if (!call_plan_sp)
         return eExecutionSetupError;
     
     call_plan_sp->SetPrivate(true);

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Wed Aug  8 19:50:26 2012
@@ -572,7 +572,7 @@
                                                                           ((m_needs_object_ptr && m_objectivec) ? &cmd_ptr : NULL),
                                                                           shared_ptr_to_me));
         
-        if (call_plan_sp == NULL || !call_plan_sp->ValidatePlan (NULL))
+        if (!call_plan_sp || !call_plan_sp->ValidatePlan (NULL))
             return eExecutionSetupError;
         
         lldb::addr_t function_stack_pointer = static_cast<ThreadPlanCallFunction *>(call_plan_sp.get())->GetFunctionStackPointer();

Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Wed Aug  8 19:50:26 2012
@@ -159,12 +159,12 @@
         
         bool IsValid ()
         {
-            return m_allocation != NULL;
+            return m_allocation;
         }
         
         bool IsInvalid ()
         {
-            return m_allocation == NULL;
+            return !m_allocation;
         }
     };
     

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Wed Aug  8 19:50:26 2012
@@ -464,7 +464,7 @@
             ret_val = pos->second;
     }
 
-    if (!exact && ret_val == NULL)
+    if (!exact && !ret_val)
     {
         // We will only get into here if we didn't find any exact matches.
         
@@ -534,7 +534,7 @@
                 return user_match_sp;
         }
     }
-    else if (matches && ret_val != NULL)
+    else if (matches && ret_val)
     {
         matches->AppendString (cmd_cstr);
     }
@@ -762,7 +762,7 @@
     help_string.Printf ("'%s", command_name);
     OptionArgVectorSP option_arg_vector_sp = GetAliasOptions (alias_name);
 
-    if (option_arg_vector_sp != NULL)
+    if (option_arg_vector_sp)
     {
         OptionArgVector *options = option_arg_vector_sp.get();
         for (int i = 0; i < options->size(); ++i)
@@ -1936,7 +1936,7 @@
 {
     CommandObjectSP cmd_obj_sp = GetCommandSPExact (dest_cmd, true);
 
-    if (cmd_obj_sp != NULL)
+    if (cmd_obj_sp)
     {
         CommandObject *cmd_obj = cmd_obj_sp.get();
         if (cmd_obj->IsCrossRefObject ())

Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Wed Aug  8 19:50:26 2012
@@ -582,7 +582,7 @@
     ExecutionContext exe_ctx (context->exe_ctx_ref);
     Process *process = exe_ctx.GetProcessPtr();
     const lldb::ABISP &abi = process->GetABI();
-    if (abi != NULL)
+    if (abi)
     {
         // Build up the value array to store the three arguments given above, then get the values from the ABI:
         

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Aug  8 19:50:26 2012
@@ -1133,7 +1133,7 @@
             {
                 SectionSP section_sp (m_section_list->FindSectionByID (n_sect));
                 m_section_infos[n_sect].section_sp = section_sp;
-                if (section_sp != NULL)
+                if (section_sp)
                 {
                     m_section_infos[n_sect].vm_range.SetBaseAddress (section_sp->GetFileAddress());
                     m_section_infos[n_sect].vm_range.SetByteSize (section_sp->GetByteSize());
@@ -2716,7 +2716,7 @@
                     {
                         symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
 
-                        if (symbol_section == NULL)
+                        if (!symbol_section)
                         {
                             // TODO: warn about this?
                             add_nlist = false;

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Wed Aug  8 19:50:26 2012
@@ -256,7 +256,7 @@
         m_frame_type = eNotAValidFrame;
         return;
     }
-    if (m_thread.GetRegisterContext() == NULL)
+    if (!m_thread.GetRegisterContext())
     {
         m_frame_type = eNotAValidFrame;
         return;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Aug  8 19:50:26 2012
@@ -1012,7 +1012,7 @@
                 // this address is resolved. If they are the same, then the
                 // function for this address didn't make it into the final
                 // executable.
-                bool curr_in_final_executable = info->curr_section_sp->GetLinkedSection () != NULL;
+                bool curr_in_final_executable = info->curr_section_sp->GetLinkedSection ();
 
                 // If we are doing DWARF with debug map, then we need to carefully
                 // add each line table entry as there may be gaps as functions

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Aug  8 19:50:26 2012
@@ -4515,7 +4515,7 @@
             StopPrivateStateThread();
             Error error;
             m_private_state_thread = backup_private_state_thread;
-            if (stopper_base_plan_sp != NULL)
+            if (stopper_base_plan_sp)
             {
                 thread->DiscardThreadPlansUpToPlan(stopper_base_plan_sp);
             }

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Wed Aug  8 19:50:26 2012
@@ -136,7 +136,7 @@
 bool
 Thread::ThreadStoppedForAReason (void)
 {
-    return GetPrivateStopReason () != NULL;
+    return GetPrivateStopReason ();
 }
 
 bool

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Wed Aug  8 19:50:26 2012
@@ -398,7 +398,7 @@
         // If we want to discard the plan, then we say we explain the stop
         // but if we are going to be discarded, let whoever is above us
         // explain the stop.
-        if (m_subplan_sp != NULL)
+        if (m_subplan_sp)
         {
             if (m_discard_on_error)
             {

Modified: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepUntil.cpp?rev=161559&r1=161558&r2=161559&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Wed Aug  8 19:50:26 2012
@@ -317,7 +317,7 @@
     // we will stop.
 
     StopInfoSP stop_info_sp = GetPrivateStopReason();
-    if (stop_info_sp == NULL || stop_info_sp->GetStopReason() == eStopReasonNone)
+    if (!stop_info_sp || stop_info_sp->GetStopReason() == eStopReasonNone)
         return false;
 
     AnalyzeStop();





More information about the lldb-commits mailing list