summaryrefslogtreecommitdiffstats
path: root/lldb/source/Breakpoint/BreakpointLocation.cpp
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2015-10-30 18:50:12 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2015-10-30 18:50:12 +0000
commit16fd7511b23a8e7a83d6fb7a2a0f345b7e55b721 (patch)
tree000e08d82b55904964048f90b07bab220d9e7830 /lldb/source/Breakpoint/BreakpointLocation.cpp
parenta8125350eaad29f9d13afe4397ad79d4a47d3fa7 (diff)
downloadbcm5719-llvm-16fd7511b23a8e7a83d6fb7a2a0f345b7e55b721.tar.gz
bcm5719-llvm-16fd7511b23a8e7a83d6fb7a2a0f345b7e55b721.zip
Fix Clang-tidy modernize-use-nullptr warnings in source/Breakpoint; other minor fixes.
llvm-svn: 251716
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointLocation.cpp')
-rw-r--r--lldb/source/Breakpoint/BreakpointLocation.cpp62
1 files changed, 27 insertions, 35 deletions
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp
index d691405862d..2ec8dc8005b 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -9,8 +9,6 @@
// C Includes
// C++ Includes
-#include <string>
-
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocation.h"
@@ -101,7 +99,7 @@ BreakpointLocation::IsEnabled () const
{
if (!m_owner.IsEnabled())
return false;
- else if (m_options_ap.get() != NULL)
+ else if (m_options_ap.get() != nullptr)
return m_options_ap->IsEnabled();
else
return true;
@@ -131,7 +129,7 @@ BreakpointLocation::SetThreadID (lldb::tid_t thread_id)
{
// If we're resetting this to an invalid thread id, then
// don't make an options pointer just to do that.
- if (m_options_ap.get() != NULL)
+ if (m_options_ap.get() != nullptr)
m_options_ap->SetThreadID (thread_id);
}
SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged);
@@ -155,11 +153,10 @@ BreakpointLocation::SetThreadIndex (uint32_t index)
{
// If we're resetting this to an invalid thread id, then
// don't make an options pointer just to do that.
- if (m_options_ap.get() != NULL)
+ if (m_options_ap.get() != nullptr)
m_options_ap->GetThreadSpec()->SetIndex(index);
}
SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged);
-
}
uint32_t
@@ -174,13 +171,13 @@ BreakpointLocation::GetThreadIndex() const
void
BreakpointLocation::SetThreadName (const char *thread_name)
{
- if (thread_name != NULL)
+ if (thread_name != nullptr)
GetLocationOptions()->GetThreadSpec()->SetName(thread_name);
else
{
// If we're resetting this to an invalid thread id, then
// don't make an options pointer just to do that.
- if (m_options_ap.get() != NULL)
+ if (m_options_ap.get() != nullptr)
m_options_ap->GetThreadSpec()->SetName(thread_name);
}
SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged);
@@ -192,19 +189,19 @@ BreakpointLocation::GetThreadName () const
if (GetOptionsNoCreate()->GetThreadSpecNoCreate())
return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetName();
else
- return NULL;
+ return nullptr;
}
void
BreakpointLocation::SetQueueName (const char *queue_name)
{
- if (queue_name != NULL)
+ if (queue_name != nullptr)
GetLocationOptions()->GetThreadSpec()->SetQueueName(queue_name);
else
{
// If we're resetting this to an invalid thread id, then
// don't make an options pointer just to do that.
- if (m_options_ap.get() != NULL)
+ if (m_options_ap.get() != nullptr)
m_options_ap->GetThreadSpec()->SetQueueName(queue_name);
}
SendBreakpointLocationChangedEvent (eBreakpointEventTypeThreadChanged);
@@ -216,13 +213,13 @@ BreakpointLocation::GetQueueName () const
if (GetOptionsNoCreate()->GetThreadSpecNoCreate())
return GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetQueueName();
else
- return NULL;
+ return nullptr;
}
bool
BreakpointLocation::InvokeCallback (StoppointCallbackContext *context)
{
- if (m_options_ap.get() != NULL && m_options_ap->HasCallback())
+ if (m_options_ap.get() != nullptr && m_options_ap->HasCallback())
return m_options_ap->InvokeCallback (context, m_owner.GetID(), GetID());
else
return m_owner.InvokeCallback (context, GetID());
@@ -246,7 +243,6 @@ BreakpointLocation::SetCallback (BreakpointHitCallback callback, const BatonSP &
SendBreakpointLocationChangedEvent (eBreakpointEventTypeCommandChanged);
}
-
void
BreakpointLocation::ClearCallback ()
{
@@ -294,10 +290,10 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
Error error;
m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage(condition_text,
- NULL,
- language,
- Expression::eResultTypeAny,
- error));
+ nullptr,
+ language,
+ Expression::eResultTypeAny,
+ error));
if (error.Fail())
{
if (log)
@@ -305,8 +301,7 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
m_user_expression_sp.reset();
return true;
}
-
-
+
StreamString errors;
if (!m_user_expression_sp->Parse(errors,
@@ -364,10 +359,7 @@ BreakpointLocation::ConditionSaysStop (ExecutionContext &exe_ctx, Error &error)
Scalar scalar_value;
if (result_value_sp->ResolveValue (scalar_value))
{
- if (scalar_value.ULongLong(1) == 0)
- ret = false;
- else
- ret = true;
+ ret = (scalar_value.ULongLong(1) != 0);
if (log)
log->Printf("Condition successfully evaluated, result is %s.\n",
ret ? "true" : "false");
@@ -409,7 +401,7 @@ BreakpointLocation::SetIgnoreCount (uint32_t n)
void
BreakpointLocation::DecrementIgnoreCount()
{
- if (m_options_ap.get() != NULL)
+ if (m_options_ap.get() != nullptr)
{
uint32_t loc_ignore = m_options_ap->GetIgnoreCount();
if (loc_ignore != 0)
@@ -420,7 +412,7 @@ BreakpointLocation::DecrementIgnoreCount()
bool
BreakpointLocation::IgnoreCountShouldStop()
{
- if (m_options_ap.get() != NULL)
+ if (m_options_ap.get() != nullptr)
{
uint32_t loc_ignore = m_options_ap->GetIgnoreCount();
if (loc_ignore != 0)
@@ -437,7 +429,7 @@ BreakpointLocation::IgnoreCountShouldStop()
const BreakpointOptions *
BreakpointLocation::GetOptionsNoCreate () const
{
- if (m_options_ap.get() != NULL)
+ if (m_options_ap.get() != nullptr)
return m_options_ap.get();
else
return m_owner.GetOptions ();
@@ -449,7 +441,7 @@ BreakpointLocation::GetLocationOptions ()
// If we make the copy we don't copy the callbacks because that is potentially
// expensive and we don't want to do that for the simple case where someone is
// just disabling the location.
- if (m_options_ap.get() == NULL)
+ if (m_options_ap.get() == nullptr)
m_options_ap.reset(BreakpointOptions::CopyOptionsNoCallback(*m_owner.GetOptions ()));
return m_options_ap.get();
@@ -521,7 +513,7 @@ BreakpointLocation::UndoBumpHitCount()
bool
BreakpointLocation::IsResolved () const
{
- return m_bp_site_sp.get() != NULL;
+ return m_bp_site_sp.get() != nullptr;
}
lldb::BreakpointSiteSP
@@ -537,7 +529,7 @@ BreakpointLocation::ResolveBreakpointSite ()
return true;
Process *process = m_owner.GetTarget().GetProcessSP().get();
- if (process == NULL)
+ if (process == nullptr)
return false;
lldb::break_id_t new_id = process->CreateBreakpointSite (shared_from_this(), m_owner.IsHardware());
@@ -625,13 +617,13 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
sc.module_sp->GetFileSpec().Dump (s);
}
- if (sc.comp_unit != NULL)
+ if (sc.comp_unit != nullptr)
{
s->EOL();
s->Indent("compile unit = ");
static_cast<FileSpec*>(sc.comp_unit)->GetFilename().Dump (s);
- if (sc.function != NULL)
+ if (sc.function != nullptr)
{
s->EOL();
s->Indent("function = ");
@@ -672,11 +664,11 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
s->Printf (", ");
s->Printf ("address = ");
- ExecutionContextScope *exe_scope = NULL;
+ ExecutionContextScope *exe_scope = nullptr;
Target *target = &m_owner.GetTarget();
if (target)
exe_scope = target->GetProcessSP().get();
- if (exe_scope == NULL)
+ if (exe_scope == nullptr)
exe_scope = target;
if (level == eDescriptionLevelInitial)
@@ -734,7 +726,7 @@ BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
void
BreakpointLocation::Dump(Stream *s) const
{
- if (s == NULL)
+ if (s == nullptr)
return;
s->Printf("BreakpointLocation %u: tid = %4.4" PRIx64 " load addr = 0x%8.8" PRIx64 " state = %s type = %s breakpoint "
OpenPOWER on IntegriCloud