forked from OSchip/llvm-project
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> llvm-svn: 161559
This commit is contained in:
parent
33baca29e5
commit
9a028519e8
|
@ -245,7 +245,7 @@ CommandObjectDisassemble::DoExecute (Args& command, CommandReturnObject &result)
|
|||
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",
|
||||
|
|
|
@ -2327,7 +2327,7 @@ Debugger::EnableLog (const char *channel, const char **categories, const char *l
|
|||
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.
|
||||
|
|
|
@ -2657,7 +2657,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
|
|||
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;
|
||||
|
|
|
@ -756,7 +756,7 @@ ClangExpressionParser::DisassembleFunction (Stream &stream, ExecutionContext &ex
|
|||
|
||||
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());
|
||||
|
|
|
@ -499,7 +499,7 @@ ClangFunction::ExecuteFunction (
|
|||
stop_others,
|
||||
discard_on_error,
|
||||
this_arg));
|
||||
if (call_plan_sp == NULL)
|
||||
if (!call_plan_sp)
|
||||
return eExecutionSetupError;
|
||||
|
||||
call_plan_sp->SetPrivate(true);
|
||||
|
|
|
@ -572,7 +572,7 @@ ClangUserExpression::Execute (Stream &error_stream,
|
|||
((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();
|
||||
|
|
|
@ -159,12 +159,12 @@ public:
|
|||
|
||||
bool IsValid ()
|
||||
{
|
||||
return m_allocation != NULL;
|
||||
return m_allocation;
|
||||
}
|
||||
|
||||
bool IsInvalid ()
|
||||
{
|
||||
return m_allocation == NULL;
|
||||
return !m_allocation;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -464,7 +464,7 @@ CommandInterpreter::GetCommandSP (const char *cmd_cstr, bool include_aliases, bo
|
|||
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 @@ CommandInterpreter::GetCommandSP (const char *cmd_cstr, bool include_aliases, bo
|
|||
return user_match_sp;
|
||||
}
|
||||
}
|
||||
else if (matches && ret_val != NULL)
|
||||
else if (matches && ret_val)
|
||||
{
|
||||
matches->AppendString (cmd_cstr);
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ CommandInterpreter::GetAliasHelp (const char *alias_name, const char *command_na
|
|||
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 @@ CommandInterpreter::CrossRegisterCommand (const char * dest_cmd, const char * ob
|
|||
{
|
||||
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 ())
|
||||
|
|
|
@ -582,7 +582,7 @@ DynamicLoaderMacOSXDYLD::NotifyBreakpointHit (void *baton,
|
|||
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:
|
||||
|
||||
|
|
|
@ -1133,7 +1133,7 @@ public:
|
|||
{
|
||||
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 @@ struct lldb_copy_dyld_cache_local_symbols_entry
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -256,7 +256,7 @@ RegisterContextLLDB::InitializeNonZerothFrame()
|
|||
m_frame_type = eNotAValidFrame;
|
||||
return;
|
||||
}
|
||||
if (m_thread.GetRegisterContext() == NULL)
|
||||
if (!m_thread.GetRegisterContext())
|
||||
{
|
||||
m_frame_type = eNotAValidFrame;
|
||||
return;
|
||||
|
|
|
@ -1012,7 +1012,7 @@ ParseDWARFLineTableCallback(dw_offset_t offset, const DWARFDebugLine::State& sta
|
|||
// 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
|
||||
|
|
|
@ -4515,7 +4515,7 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx,
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ Thread::SetStopInfoToNothing()
|
|||
bool
|
||||
Thread::ThreadStoppedForAReason (void)
|
||||
{
|
||||
return GetPrivateStopReason () != NULL;
|
||||
return GetPrivateStopReason ();
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -398,7 +398,7 @@ ThreadPlanCallFunction::PlanExplainsStop ()
|
|||
// 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)
|
||||
{
|
||||
|
|
|
@ -317,7 +317,7 @@ ThreadPlanStepUntil::ShouldStop (Event *event_ptr)
|
|||
// 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();
|
||||
|
|
Loading…
Reference in New Issue