Author: eugenezelenko Date: Fri Oct 30 13:50:12 2015 New Revision: 251716 URL: http://llvm.org/viewvc/llvm-project?rev=251716&view=rev Log: Fix Clang-tidy modernize-use-nullptr warnings in source/Breakpoint; other minor fixes.
Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp lldb/trunk/source/Breakpoint/BreakpointID.cpp lldb/trunk/source/Breakpoint/BreakpointIDList.cpp lldb/trunk/source/Breakpoint/BreakpointLocation.cpp lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp lldb/trunk/source/Breakpoint/BreakpointOptions.cpp lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Breakpoint/BreakpointSite.cpp lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp lldb/trunk/source/Breakpoint/Watchpoint.cpp lldb/trunk/source/Breakpoint/WatchpointOptions.cpp Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Fri Oct 30 13:50:12 2015 @@ -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_targ //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- -Breakpoint::~Breakpoint() -{ -} +Breakpoint::~Breakpoint() = default; const lldb::TargetSP Breakpoint::GetTargetSP () @@ -236,7 +233,7 @@ Breakpoint::SetThreadID (lldb::tid_t thr 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 ind 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 *t 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 *qu 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 & if (!seen) new_modules.AppendIfNeeded (module_sp); - } if (new_modules.GetSize() > 0) @@ -474,7 +470,7 @@ Breakpoint::ModulesChanged (ModuleList & 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 & } if (delete_locations) locations_to_remove.Add (break_loc_sp); - } } @@ -568,7 +563,7 @@ SymbolContextsMightBeEquivalent(SymbolCo } return equivalent_scs; } -} +} // anonymous namespace void Breakpoint::ModuleReplaced (ModuleSP old_module_sp, ModuleSP new_module_sp) @@ -740,7 +735,7 @@ Breakpoint::ModuleReplaced (ModuleSP old 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_nam void Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations) { - assert (s != NULL); + assert (s != nullptr); if (!m_kind_description.empty()) { @@ -876,7 +871,7 @@ Breakpoint::GetDescription (Stream *s, 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 +917,6 @@ Breakpoint::GetResolverDescription (Stre m_resolver_sp->GetDescription (s); } - bool Breakpoint::GetMatchingFileLine (const ConstString &filename, uint32_t line_number, BreakpointLocationCollection &loc_coll) { @@ -993,8 +987,7 @@ Breakpoint::SendBreakpointChangedEvent ( void Breakpoint::SendBreakpointChangedEvent (BreakpointEventData *data) { - - if (data == NULL) + if (data == nullptr) return; if (!m_being_created @@ -1013,9 +1006,7 @@ Breakpoint::BreakpointEventData::Breakpo { } -Breakpoint::BreakpointEventData::~BreakpointEventData () -{ -} +Breakpoint::BreakpointEventData::~BreakpointEventData() = default; const ConstString & Breakpoint::BreakpointEventData::GetFlavorString () @@ -1030,7 +1021,6 @@ Breakpoint::BreakpointEventData::GetFlav return BreakpointEventData::GetFlavorString (); } - BreakpointSP & Breakpoint::BreakpointEventData::GetBreakpoint () { @@ -1057,7 +1047,7 @@ Breakpoint::BreakpointEventData::GetEven if (event_data && event_data->GetFlavor() == BreakpointEventData::GetFlavorString()) return static_cast <const BreakpointEventData *> (event->GetData()); } - return NULL; + return nullptr; } BreakpointEventType @@ -1065,7 +1055,7 @@ Breakpoint::BreakpointEventData::GetBrea { const BreakpointEventData *data = GetEventDataFromEvent (event_sp.get()); - if (data == NULL) + if (data == nullptr) return eBreakpointEventTypeInvalidType; else return data->GetBreakpointEventType(); Modified: lldb/trunk/source/Breakpoint/BreakpointID.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointID.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointID.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointID.cpp Fri Oct 30 13:50:12 2015 @@ -7,14 +7,12 @@ // //===----------------------------------------------------------------------===// - // C Includes #include <stdio.h> // C++ Includes // Other libraries and framework includes // Project includes - #include "lldb/Breakpoint/BreakpointID.h" #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Core/Stream.h" @@ -29,11 +27,9 @@ BreakpointID::BreakpointID (break_id_t b { } -BreakpointID::~BreakpointID () -{ -} +BreakpointID::~BreakpointID() = default; -const char *BreakpointID::g_range_specifiers[] = { "-", "to", "To", "TO", NULL }; +const char *BreakpointID::g_range_specifiers[] = { "-", "to", "To", "TO", nullptr }; // Tells whether or not STR is valid to use between two strings representing breakpoint IDs, to // indicate a range of breakpoint IDs. This is broken out into a separate function so that we can @@ -43,7 +39,7 @@ bool BreakpointID::IsRangeIdentifier (const char *str) { int specifier_count = 0; - for (int i = 0; g_range_specifiers[i] != NULL; ++i) + for (int i = 0; g_range_specifiers[i] != nullptr; ++i) ++specifier_count; for (int i = 0; i < specifier_count; ++i) @@ -62,10 +58,7 @@ BreakpointID::IsValidIDExpression (const break_id_t loc_id; BreakpointID::ParseCanonicalReference (str, &bp_id, &loc_id); - if (bp_id == LLDB_INVALID_BREAK_ID) - return false; - else - return true; + return (bp_id != LLDB_INVALID_BREAK_ID); } void @@ -99,7 +92,7 @@ BreakpointID::ParseCanonicalReference (c *break_id_ptr = LLDB_INVALID_BREAK_ID; *break_loc_id_ptr = LLDB_INVALID_BREAK_ID; - if (input == NULL || *input == '\0') + if (input == nullptr || *input == '\0') return false; const char *format = "%i%n.%i%n"; Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Fri Oct 30 13:50:12 2015 @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes #include "lldb/Breakpoint/BreakpointIDList.h" #include "lldb/Breakpoint/Breakpoint.h" @@ -27,9 +31,7 @@ m_invalid_id (LLDB_INVALID_BREAK_ID, LLD { } -BreakpointIDList::~BreakpointIDList () -{ -} +BreakpointIDList::~BreakpointIDList() = default; size_t BreakpointIDList::GetSize() @@ -38,12 +40,9 @@ BreakpointIDList::GetSize() } BreakpointID & -BreakpointIDList::GetBreakpointIDAtIndex (size_t index) +BreakpointIDList::GetBreakpointIDAtIndex(size_t index) { - if (index < m_breakpoint_ids.size()) - return m_breakpoint_ids[index]; - else - return m_invalid_id; + return ((index < m_breakpoint_ids.size()) ? m_breakpoint_ids[index] : m_invalid_id); } bool @@ -124,7 +123,7 @@ BreakpointIDList::FindBreakpointID (cons void BreakpointIDList::InsertStringArray (const char **string_array, size_t array_size, CommandReturnObject &result) { - if (string_array == NULL) + if (string_array == nullptr) return; for (uint32_t i = 0; i < array_size; ++i) @@ -385,7 +384,6 @@ BreakpointIDList::FindAndReplaceIDRanges } result.SetStatus (eReturnStatusSuccessFinishNoResult); - return; } bool @@ -402,7 +400,7 @@ BreakpointIDList::StringContainsIDRangeE *range_end_pos = 0; int specifiers_size = 0; - for (int i = 0; BreakpointID::g_range_specifiers[i] != NULL; ++i) + for (int i = 0; BreakpointID::g_range_specifiers[i] != nullptr; ++i) ++specifiers_size; for (int i = 0; i < specifiers_size && !is_range_expression; ++i) Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Fri Oct 30 13:50:12 2015 @@ -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::t { // 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 (uint { // 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() con 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 () con 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 () cons 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 (Breakpo SendBreakpointLocationChangedEvent (eBreakpointEventTypeCommandChanged); } - void BreakpointLocation::ClearCallback () { @@ -294,10 +290,10 @@ BreakpointLocation::ConditionSaysStop (E 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 (E m_user_expression_sp.reset(); return true; } - - + StreamString errors; if (!m_user_expression_sp->Parse(errors, @@ -364,10 +359,7 @@ BreakpointLocation::ConditionSaysStop (E 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 (uint 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::IgnoreCountShouldSto 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::ResolveBreakpointSit 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 (Stre 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 (Stre 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 (Stre 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 " Modified: lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp Fri Oct 30 13:50:12 2015 @@ -7,7 +7,6 @@ // //===----------------------------------------------------------------------===// - // C Includes // C++ Includes // Other libraries and framework includes @@ -22,7 +21,6 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" - using namespace lldb; using namespace lldb_private; @@ -32,13 +30,11 @@ BreakpointLocationList::BreakpointLocati m_address_to_location (), m_mutex (Mutex::eMutexTypeRecursive), m_next_id (0), - m_new_location_recorder (NULL) + m_new_location_recorder (nullptr) { } -BreakpointLocationList::~BreakpointLocationList() -{ -} +BreakpointLocationList::~BreakpointLocationList() = default; BreakpointLocationSP BreakpointLocationList::Create (const Address &addr, bool resolve_indirect_symbols) @@ -163,7 +159,6 @@ BreakpointLocationList::Dump (Stream *s) s->IndentLess(); } - BreakpointLocationSP BreakpointLocationList::GetByIndex (size_t i) { @@ -285,7 +280,6 @@ BreakpointLocationList::SwapLocation (Br to_location_sp->ResolveBreakpointSite(); } - bool BreakpointLocationList::RemoveLocation (const lldb::BreakpointLocationSP &bp_loc_sp) { @@ -304,7 +298,7 @@ BreakpointLocationList::RemoveLocation ( return true; } } - } + } return false; } @@ -348,7 +342,7 @@ void BreakpointLocationList::StartRecordingNewLocations (BreakpointLocationCollection &new_locations) { Mutex::Locker locker (m_mutex); - assert (m_new_location_recorder == NULL); + assert(m_new_location_recorder == nullptr); m_new_location_recorder = &new_locations; } @@ -356,7 +350,7 @@ void BreakpointLocationList::StopRecordingNewLocations () { Mutex::Locker locker (m_mutex); - m_new_location_recorder = NULL; + m_new_location_recorder = nullptr; } void Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Fri Oct 30 13:50:12 2015 @@ -7,12 +7,12 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Breakpoint/BreakpointOptions.h" - // C Includes // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Breakpoint/BreakpointOptions.h" + #include "lldb/Core/Stream.h" #include "lldb/Core/StringList.h" #include "lldb/Core/Value.h" @@ -58,7 +58,7 @@ BreakpointOptions::BreakpointOptions(con m_ignore_count (rhs.m_ignore_count), m_thread_spec_ap () { - if (rhs.m_thread_spec_ap.get() != NULL) + if (rhs.m_thread_spec_ap.get() != nullptr) m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get())); m_condition_text = rhs.m_condition_text; m_condition_text_hash = rhs.m_condition_text_hash; @@ -76,7 +76,7 @@ BreakpointOptions::operator=(const Break m_enabled = rhs.m_enabled; m_one_shot = rhs.m_one_shot; m_ignore_count = rhs.m_ignore_count; - if (rhs.m_thread_spec_ap.get() != NULL) + if (rhs.m_thread_spec_ap.get() != nullptr) m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get())); m_condition_text = rhs.m_condition_text; m_condition_text_hash = rhs.m_condition_text_hash; @@ -101,9 +101,7 @@ BreakpointOptions::CopyOptionsNoCallback //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- -BreakpointOptions::~BreakpointOptions() -{ -} +BreakpointOptions::~BreakpointOptions() = default; //------------------------------------------------------------------ // Callbacks @@ -143,10 +141,10 @@ BreakpointOptions::InvokeCallback (Stopp { if (m_callback && context->is_synchronous == IsCallbackSynchronous()) { - return m_callback (m_callback_baton_sp ? m_callback_baton_sp->m_data : NULL, - context, - break_id, - break_loc_id); + return m_callback(m_callback_baton_sp ? m_callback_baton_sp->m_data : nullptr, + context, + break_id, + break_loc_id); } else return true; @@ -181,7 +179,7 @@ BreakpointOptions::GetConditionText (siz } else { - return NULL; + return nullptr; } } @@ -194,7 +192,7 @@ BreakpointOptions::GetThreadSpecNoCreate ThreadSpec * BreakpointOptions::GetThreadSpec () { - if (m_thread_spec_ap.get() == NULL) + if (m_thread_spec_ap.get() == nullptr) m_thread_spec_ap.reset (new ThreadSpec()); return m_thread_spec_ap.get(); @@ -209,11 +207,10 @@ BreakpointOptions::SetThreadID (lldb::ti void BreakpointOptions::GetDescription (Stream *s, lldb::DescriptionLevel level) const { - // Figure out if there are any options not at their default value, and only print // anything if there are: - if (m_ignore_count != 0 || !m_enabled || m_one_shot || (GetThreadSpecNoCreate() != NULL && GetThreadSpecNoCreate()->HasSpecification ())) + if (m_ignore_count != 0 || !m_enabled || m_one_shot || (GetThreadSpecNoCreate() != nullptr && GetThreadSpecNoCreate()->HasSpecification ())) { if (level == lldb::eDescriptionLevelVerbose) { @@ -293,4 +290,3 @@ BreakpointOptions::CommandBaton::GetDesc s->IndentLess (); s->IndentLess (); } - Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Fri Oct 30 13:50:12 2015 @@ -7,12 +7,12 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Breakpoint/BreakpointResolverName.h" - // C Includes // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Breakpoint/BreakpointResolverName.h" + #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" @@ -39,7 +39,6 @@ BreakpointResolverName::BreakpointResolv m_language (language), m_skip_prologue (skip_prologue) { - if (m_match_type == Breakpoint::Regexp) { if (!m_regex.Compile (name_cstr)) @@ -93,7 +92,7 @@ BreakpointResolverName::BreakpointResolv RegularExpression &func_regex, bool skip_prologue) : BreakpointResolver (bkpt, BreakpointResolver::NameResolver), - m_class_name (NULL), + m_class_name (nullptr), m_regex (func_regex), m_match_type (Breakpoint::Regexp), m_language (eLanguageTypeUnknown), @@ -101,14 +100,11 @@ BreakpointResolverName::BreakpointResolv { } -BreakpointResolverName::BreakpointResolverName -( - Breakpoint *bkpt, - const char *class_name, - const char *method, - Breakpoint::MatchType type, - bool skip_prologue -) : +BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt, + const char *class_name, + const char *method, + Breakpoint::MatchType type, + bool skip_prologue ) : BreakpointResolver (bkpt, BreakpointResolver::NameResolver), m_class_name (class_name), m_regex (), @@ -124,9 +120,7 @@ BreakpointResolverName::BreakpointResolv m_lookups.push_back (lookup); } -BreakpointResolverName::~BreakpointResolverName () -{ -} +BreakpointResolverName::~BreakpointResolverName() = default; BreakpointResolverName::BreakpointResolverName(const BreakpointResolverName &rhs) : BreakpointResolver(rhs.m_breakpoint, BreakpointResolver::NameResolver), @@ -137,7 +131,6 @@ BreakpointResolverName::BreakpointResolv m_language (rhs.m_language), m_skip_prologue (rhs.m_skip_prologue) { - } void @@ -167,7 +160,6 @@ BreakpointResolverName::AddNameLookup (c } } - void BreakpointResolverName::LookupInfo::Prune (SymbolContextList &sc_list, size_t start_idx) const { @@ -180,7 +172,7 @@ BreakpointResolverName::LookupInfo::Prun if (!sc_list.GetContextAtIndex(i, sc)) break; ConstString full_name (sc.GetFunctionName()); - if (full_name && ::strstr(full_name.GetCString(), name.GetCString()) == NULL) + if (full_name && ::strstr(full_name.GetCString(), name.GetCString()) == nullptr) { sc_list.RemoveContextAtIndex(i); } @@ -192,19 +184,15 @@ BreakpointResolverName::LookupInfo::Prun } } - // FIXME: Right now we look at the module level, and call the module's "FindFunctions". // Greg says he will add function tables, maybe at the CompileUnit level to accelerate function // lookup. At that point, we should switch the depth to CompileUnit, and look in these tables. Searcher::CallbackReturn -BreakpointResolverName::SearchCallback -( - SearchFilter &filter, - SymbolContext &context, - Address *addr, - bool containing -) +BreakpointResolverName::SearchCallback(SearchFilter &filter, + SymbolContext &context, + Address *addr, + bool containing) { SymbolContextList func_list; //SymbolContextList sym_list; @@ -212,7 +200,7 @@ BreakpointResolverName::SearchCallback uint32_t i; bool new_location; Address break_addr; - assert (m_breakpoint != NULL); + assert (m_breakpoint != nullptr); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); @@ -223,7 +211,7 @@ BreakpointResolverName::SearchCallback return Searcher::eCallbackReturnStop; } bool filter_by_cu = (filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0; - const bool include_symbols = filter_by_cu == false; + const bool include_symbols = !filter_by_cu; const bool include_inlines = true; const bool append = true; @@ -235,13 +223,13 @@ BreakpointResolverName::SearchCallback for (const LookupInfo &lookup : m_lookups) { const size_t start_func_idx = func_list.GetSize(); - context.module_sp->FindFunctions (lookup.lookup_name, - NULL, - lookup.name_type_mask, - include_symbols, - include_inlines, - append, - func_list); + context.module_sp->FindFunctions(lookup.lookup_name, + nullptr, + lookup.name_type_mask, + include_symbols, + include_inlines, + append, + func_list); const size_t end_func_idx = func_list.GetSize(); if (start_func_idx < end_func_idx) @@ -387,7 +375,6 @@ BreakpointResolverName::GetDescription ( void BreakpointResolverName::Dump (Stream *s) const { - } lldb::BreakpointResolverSP Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Fri Oct 30 13:50:12 2015 @@ -7,14 +7,14 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Breakpoint/BreakpointSite.h" - // C Includes // C++ Includes #include <inttypes.h> // Other libraries and framework includes // Project includes +#include "lldb/Breakpoint/BreakpointSite.h" + #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Breakpoint/BreakpointSiteList.h" @@ -23,13 +23,10 @@ using namespace lldb; using namespace lldb_private; -BreakpointSite::BreakpointSite -( - BreakpointSiteList *list, - const BreakpointLocationSP& owner, - lldb::addr_t addr, - bool use_hardware -) : +BreakpointSite::BreakpointSite(BreakpointSiteList *list, + const BreakpointLocationSP& owner, + lldb::addr_t addr, + bool use_hardware) : StoppointLocation(GetNextID(), addr, 0, use_hardware), m_type (eSoftware), // Process subclasses need to set this correctly using SetType() m_saved_opcode(), @@ -85,7 +82,7 @@ BreakpointSite::IsBreakpointAtThisSite ( void BreakpointSite::Dump(Stream *s) const { - if (s == NULL) + if (s == nullptr) return; s->Printf("BreakpointSite %u: addr = 0x%8.8" PRIx64 " type = %s breakpoint hw_index = %i hit_count = %-4u", Modified: lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp (original) +++ lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp Fri Oct 30 13:50:12 2015 @@ -7,17 +7,16 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Breakpoint/StoppointCallbackContext.h" - // C Includes // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Breakpoint/StoppointCallbackContext.h" using namespace lldb_private; StoppointCallbackContext::StoppointCallbackContext() : - event (NULL), + event (nullptr), exe_ctx_ref (), is_synchronous (false) { @@ -33,7 +32,7 @@ StoppointCallbackContext::StoppointCallb void StoppointCallbackContext::Clear() { - event = NULL; + event = nullptr; exe_ctx_ref.Clear(); is_synchronous = false; } Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Fri Oct 30 13:50:12 2015 @@ -7,12 +7,12 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Breakpoint/Watchpoint.h" - // C Includes // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Breakpoint/Watchpoint.h" + #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Stream.h" #include "lldb/Core/Value.h" @@ -67,9 +67,7 @@ Watchpoint::Watchpoint (Target& target, m_being_created = false; } -Watchpoint::~Watchpoint() -{ -} +Watchpoint::~Watchpoint() = default; // This function is used when "baton" doesn't need to be freed void @@ -102,7 +100,6 @@ void Watchpoint::SetDeclInfo (const std::string &str) { m_decl_str = str; - return; } std::string @@ -115,7 +112,6 @@ void Watchpoint::SetWatchSpec (const std::string &str) { m_watch_spec_str = str; - return; } // Override default impl of StoppointLocation::IsHardware() since m_is_hardware @@ -154,10 +150,7 @@ Watchpoint::CaptureWatchedValue (const E } m_new_value_sp = ValueObjectMemory::Create (exe_ctx.GetBestExecutionContextScope(), watch_name.AsCString(), watch_address, m_type); m_new_value_sp = m_new_value_sp->CreateConstantValue(watch_name); - if (m_new_value_sp && m_new_value_sp->GetError().Success()) - return true; - else - return false; + return (m_new_value_sp && m_new_value_sp->GetError().Success()); } void @@ -200,7 +193,6 @@ void Watchpoint::GetDescription (Stream *s, lldb::DescriptionLevel level) { DumpWithLevel(s, level); - return; } void @@ -209,7 +201,7 @@ Watchpoint::Dump(Stream *s) const DumpWithLevel(s, lldb::eDescriptionLevelBrief); } -// If prefix is NULL, we display the watch id and ignore the prefix altogether. +// If prefix is nullptr, we display the watch id and ignore the prefix altogether. void Watchpoint::DumpSnapshots(Stream *s, const char *prefix) const { @@ -249,7 +241,7 @@ Watchpoint::DumpSnapshots(Stream *s, con void Watchpoint::DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const { - if (s == NULL) + if (s == nullptr) return; assert(description_level >= lldb::eDescriptionLevelBrief && @@ -351,11 +343,13 @@ Watchpoint::WatchpointRead () const { return m_watch_read != 0; } + bool Watchpoint::WatchpointWrite () const { return m_watch_write != 0; } + uint32_t Watchpoint::GetIgnoreCount () const { @@ -380,20 +374,20 @@ Watchpoint::InvokeCallback (StoppointCal void Watchpoint::SetCondition (const char *condition) { - if (condition == NULL || condition[0] == '\0') + if (condition == nullptr || condition[0] == '\0') { if (m_condition_ap.get()) m_condition_ap.reset(); } else { - // Pass NULL for expr_prefix (no translation-unit level definitions). + // Pass nullptr for expr_prefix (no translation-unit level definitions). Error error; - m_condition_ap.reset(m_target.GetUserExpressionForLanguage (condition, - NULL, - lldb::eLanguageTypeUnknown, - UserExpression::eResultTypeAny, - error)); + m_condition_ap.reset(m_target.GetUserExpressionForLanguage(condition, + nullptr, + lldb::eLanguageTypeUnknown, + UserExpression::eResultTypeAny, + error)); if (error.Fail()) { // FIXME: Log something... @@ -409,7 +403,7 @@ Watchpoint::GetConditionText () const if (m_condition_ap.get()) return m_condition_ap->GetUserText(); else - return NULL; + return nullptr; } void @@ -426,8 +420,7 @@ Watchpoint::SendWatchpointChangedEvent ( void Watchpoint::SendWatchpointChangedEvent (WatchpointEventData *data) { - - if (data == NULL) + if (data == nullptr) return; if (!m_being_created @@ -445,9 +438,7 @@ Watchpoint::WatchpointEventData::Watchpo { } -Watchpoint::WatchpointEventData::~WatchpointEventData () -{ -} +Watchpoint::WatchpointEventData::~WatchpointEventData() = default; const ConstString & Watchpoint::WatchpointEventData::GetFlavorString () @@ -462,7 +453,6 @@ Watchpoint::WatchpointEventData::GetFlav return WatchpointEventData::GetFlavorString (); } - WatchpointSP & Watchpoint::WatchpointEventData::GetWatchpoint () { @@ -489,7 +479,7 @@ Watchpoint::WatchpointEventData::GetEven if (event_data && event_data->GetFlavor() == WatchpointEventData::GetFlavorString()) return static_cast <const WatchpointEventData *> (event->GetData()); } - return NULL; + return nullptr; } WatchpointEventType @@ -497,7 +487,7 @@ Watchpoint::WatchpointEventData::GetWatc { const WatchpointEventData *data = GetEventDataFromEvent (event_sp.get()); - if (data == NULL) + if (data == nullptr) return eWatchpointEventTypeInvalidType; else return data->GetWatchpointEventType(); Modified: lldb/trunk/source/Breakpoint/WatchpointOptions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointOptions.cpp?rev=251716&r1=251715&r2=251716&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/WatchpointOptions.cpp (original) +++ lldb/trunk/source/Breakpoint/WatchpointOptions.cpp Fri Oct 30 13:50:12 2015 @@ -7,12 +7,12 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Breakpoint/WatchpointOptions.h" - // C Includes // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Breakpoint/WatchpointOptions.h" + #include "lldb/Core/Stream.h" #include "lldb/Core/StringList.h" #include "lldb/Core/Value.h" @@ -50,7 +50,7 @@ WatchpointOptions::WatchpointOptions(con m_callback_is_synchronous (rhs.m_callback_is_synchronous), m_thread_spec_ap () { - if (rhs.m_thread_spec_ap.get() != NULL) + if (rhs.m_thread_spec_ap.get() != nullptr) m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get())); } @@ -63,7 +63,7 @@ WatchpointOptions::operator=(const Watch m_callback = rhs.m_callback; m_callback_baton_sp = rhs.m_callback_baton_sp; m_callback_is_synchronous = rhs.m_callback_is_synchronous; - if (rhs.m_thread_spec_ap.get() != NULL) + if (rhs.m_thread_spec_ap.get() != nullptr) m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get())); return *this; } @@ -86,9 +86,7 @@ WatchpointOptions::CopyOptionsNoCallback //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- -WatchpointOptions::~WatchpointOptions() -{ -} +WatchpointOptions::~WatchpointOptions() = default; //------------------------------------------------------------------ // Callbacks @@ -127,9 +125,9 @@ WatchpointOptions::InvokeCallback (Stopp { if (m_callback && context->is_synchronous == IsCallbackSynchronous()) { - return m_callback (m_callback_baton_sp ? m_callback_baton_sp->m_data : NULL, - context, - watch_id); + return m_callback(m_callback_baton_sp ? m_callback_baton_sp->m_data : nullptr, + context, + watch_id); } else return true; @@ -150,7 +148,7 @@ WatchpointOptions::GetThreadSpecNoCreate ThreadSpec * WatchpointOptions::GetThreadSpec () { - if (m_thread_spec_ap.get() == NULL) + if (m_thread_spec_ap.get() == nullptr) m_thread_spec_ap.reset (new ThreadSpec()); return m_thread_spec_ap.get(); @@ -171,14 +169,14 @@ WatchpointOptions::GetCallbackDescriptio m_callback_baton_sp->GetDescription (s, level); } } + void WatchpointOptions::GetDescription (Stream *s, lldb::DescriptionLevel level) const { - // Figure out if there are any options not at their default value, and only print // anything if there are: - if ((GetThreadSpecNoCreate() != NULL && GetThreadSpecNoCreate()->HasSpecification ())) + if ((GetThreadSpecNoCreate() != nullptr && GetThreadSpecNoCreate()->HasSpecification ())) { if (level == lldb::eDescriptionLevelVerbose) { @@ -237,4 +235,3 @@ WatchpointOptions::CommandBaton::GetDesc s->IndentLess (); s->IndentLess (); } - _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits