diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Breakpoint/Breakpoint.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Breakpoint/Breakpoint.cpp | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/contrib/llvm/tools/lldb/source/Breakpoint/Breakpoint.cpp b/contrib/llvm/tools/lldb/source/Breakpoint/Breakpoint.cpp index 23d484f..54f67b9 100644 --- a/contrib/llvm/tools/lldb/source/Breakpoint/Breakpoint.cpp +++ b/contrib/llvm/tools/lldb/source/Breakpoint/Breakpoint.cpp @@ -7,12 +7,12 @@ // //===----------------------------------------------------------------------===// - // C Includes // C++ Includes // Other libraries and framework includes -// Project includes +#include "llvm/Support/Casting.h" +// Project includes #include "lldb/Core/Address.h" #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" @@ -31,7 +31,6 @@ #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadSpec.h" -#include "llvm/Support/Casting.h" using namespace lldb; using namespace lldb_private; @@ -83,9 +82,7 @@ Breakpoint::Breakpoint (Target &new_target, Breakpoint &source_bp) : //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- -Breakpoint::~Breakpoint() -{ -} +Breakpoint::~Breakpoint() = default; const lldb::TargetSP Breakpoint::GetTargetSP () @@ -236,7 +233,7 @@ Breakpoint::SetThreadID (lldb::tid_t thread_id) lldb::tid_t Breakpoint::GetThreadID () const { - if (m_options.GetThreadSpecNoCreate() == NULL) + if (m_options.GetThreadSpecNoCreate() == nullptr) return LLDB_INVALID_THREAD_ID; else return m_options.GetThreadSpecNoCreate()->GetTID(); @@ -255,7 +252,7 @@ Breakpoint::SetThreadIndex (uint32_t index) uint32_t Breakpoint::GetThreadIndex() const { - if (m_options.GetThreadSpecNoCreate() == NULL) + if (m_options.GetThreadSpecNoCreate() == nullptr) return 0; else return m_options.GetThreadSpecNoCreate()->GetIndex(); @@ -264,7 +261,7 @@ Breakpoint::GetThreadIndex() const void Breakpoint::SetThreadName (const char *thread_name) { - if (m_options.GetThreadSpec()->GetName() != NULL + if (m_options.GetThreadSpec()->GetName() != nullptr && ::strcmp (m_options.GetThreadSpec()->GetName(), thread_name) == 0) return; @@ -275,8 +272,8 @@ Breakpoint::SetThreadName (const char *thread_name) const char * Breakpoint::GetThreadName () const { - if (m_options.GetThreadSpecNoCreate() == NULL) - return NULL; + if (m_options.GetThreadSpecNoCreate() == nullptr) + return nullptr; else return m_options.GetThreadSpecNoCreate()->GetName(); } @@ -284,7 +281,7 @@ Breakpoint::GetThreadName () const void Breakpoint::SetQueueName (const char *queue_name) { - if (m_options.GetThreadSpec()->GetQueueName() != NULL + if (m_options.GetThreadSpec()->GetQueueName() != nullptr && ::strcmp (m_options.GetThreadSpec()->GetQueueName(), queue_name) == 0) return; @@ -295,8 +292,8 @@ Breakpoint::SetQueueName (const char *queue_name) const char * Breakpoint::GetQueueName () const { - if (m_options.GetThreadSpecNoCreate() == NULL) - return NULL; + if (m_options.GetThreadSpecNoCreate() == nullptr) + return nullptr; else return m_options.GetThreadSpecNoCreate()->GetQueueName(); } @@ -456,7 +453,6 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load, bool delete_loca if (!seen) new_modules.AppendIfNeeded (module_sp); - } if (new_modules.GetSize() > 0) @@ -474,7 +470,7 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load, bool delete_loca removed_locations_event = new BreakpointEventData (eBreakpointEventTypeLocationsRemoved, shared_from_this()); else - removed_locations_event = NULL; + removed_locations_event = nullptr; size_t num_modules = module_list.GetSize(); for (size_t i = 0; i < num_modules; i++) @@ -502,7 +498,6 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load, bool delete_loca } if (delete_locations) locations_to_remove.Add (break_loc_sp); - } } @@ -568,7 +563,7 @@ SymbolContextsMightBeEquivalent(SymbolContext &old_sc, SymbolContext &new_sc) } return equivalent_scs; } -} +} // anonymous namespace void Breakpoint::ModuleReplaced (ModuleSP old_module_sp, ModuleSP new_module_sp) @@ -740,7 +735,7 @@ Breakpoint::ModuleReplaced (ModuleSP old_module_sp, ModuleSP new_module_sp) locations_event = new BreakpointEventData (eBreakpointEventTypeLocationsRemoved, shared_from_this()); else - locations_event = NULL; + locations_event = nullptr; for (BreakpointLocationSP loc_sp : locations_to_remove.BreakpointLocations()) { @@ -804,7 +799,7 @@ Breakpoint::AddName (const char *new_name, Error &error) void Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations) { - assert (s != NULL); + assert (s != nullptr); if (!m_kind_description.empty()) { @@ -849,6 +844,9 @@ Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_l GetOptions()->GetDescription(s, level); + if (m_precondition_sp) + m_precondition_sp->GetDescription(*s, level); + if (level == lldb::eDescriptionLevelFull) { if (!m_name_list.empty()) @@ -876,7 +874,7 @@ Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_l { s->Printf ("no locations (pending)."); } - else if (num_locations == 1 && show_locations == false) + else if (num_locations == 1 && !show_locations) { // There is only one location, so we'll just print that location information. GetLocationAtIndex(0)->GetDescription(s, level); @@ -922,7 +920,6 @@ Breakpoint::GetResolverDescription (Stream *s) m_resolver_sp->GetDescription (s); } - bool Breakpoint::GetMatchingFileLine (const ConstString &filename, uint32_t line_number, BreakpointLocationCollection &loc_coll) { @@ -965,7 +962,7 @@ Breakpoint::BreakpointPrecondition::EvaluatePrecondition(StoppointCallbackContex } void -Breakpoint::BreakpointPrecondition::DescribePrecondition(Stream &stream, lldb::DescriptionLevel level) +Breakpoint::BreakpointPrecondition::GetDescription(Stream &stream, lldb::DescriptionLevel level) { } @@ -993,8 +990,7 @@ Breakpoint::SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind) void Breakpoint::SendBreakpointChangedEvent (BreakpointEventData *data) { - - if (data == NULL) + if (data == nullptr) return; if (!m_being_created @@ -1013,9 +1009,7 @@ Breakpoint::BreakpointEventData::BreakpointEventData (BreakpointEventType sub_ty { } -Breakpoint::BreakpointEventData::~BreakpointEventData () -{ -} +Breakpoint::BreakpointEventData::~BreakpointEventData() = default; const ConstString & Breakpoint::BreakpointEventData::GetFlavorString () @@ -1030,7 +1024,6 @@ Breakpoint::BreakpointEventData::GetFlavor () const return BreakpointEventData::GetFlavorString (); } - BreakpointSP & Breakpoint::BreakpointEventData::GetBreakpoint () { @@ -1057,7 +1050,7 @@ Breakpoint::BreakpointEventData::GetEventDataFromEvent (const Event *event) if (event_data && event_data->GetFlavor() == BreakpointEventData::GetFlavorString()) return static_cast <const BreakpointEventData *> (event->GetData()); } - return NULL; + return nullptr; } BreakpointEventType @@ -1065,7 +1058,7 @@ Breakpoint::BreakpointEventData::GetBreakpointEventTypeFromEvent (const EventSP { const BreakpointEventData *data = GetEventDataFromEvent (event_sp.get()); - if (data == NULL) + if (data == nullptr) return eBreakpointEventTypeInvalidType; else return data->GetBreakpointEventType(); |