diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Breakpoint/WatchpointOptions.cpp | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/source/Breakpoint/WatchpointOptions.cpp')
-rw-r--r-- | lldb/source/Breakpoint/WatchpointOptions.cpp | 282 |
1 files changed, 122 insertions, 160 deletions
diff --git a/lldb/source/Breakpoint/WatchpointOptions.cpp b/lldb/source/Breakpoint/WatchpointOptions.cpp index 365d884691e..1108f44561c 100644 --- a/lldb/source/Breakpoint/WatchpointOptions.cpp +++ b/lldb/source/Breakpoint/WatchpointOptions.cpp @@ -13,10 +13,10 @@ // Project includes #include "lldb/Breakpoint/WatchpointOptions.h" +#include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StringList.h" #include "lldb/Core/Value.h" -#include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadSpec.h" @@ -24,63 +24,55 @@ using namespace lldb; using namespace lldb_private; -bool -WatchpointOptions::NullCallback (void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id) -{ - return true; +bool WatchpointOptions::NullCallback(void *baton, + StoppointCallbackContext *context, + lldb::user_id_t watch_id) { + return true; } //---------------------------------------------------------------------- // WatchpointOptions constructor //---------------------------------------------------------------------- -WatchpointOptions::WatchpointOptions() : - m_callback (WatchpointOptions::NullCallback), - m_callback_baton_sp (), - m_callback_is_synchronous (false), - m_thread_spec_ap () -{ -} +WatchpointOptions::WatchpointOptions() + : m_callback(WatchpointOptions::NullCallback), m_callback_baton_sp(), + m_callback_is_synchronous(false), m_thread_spec_ap() {} //---------------------------------------------------------------------- // WatchpointOptions copy constructor //---------------------------------------------------------------------- -WatchpointOptions::WatchpointOptions(const WatchpointOptions& rhs) : - m_callback (rhs.m_callback), - m_callback_baton_sp (rhs.m_callback_baton_sp), - m_callback_is_synchronous (rhs.m_callback_is_synchronous), - m_thread_spec_ap () -{ - if (rhs.m_thread_spec_ap.get() != nullptr) - m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get())); +WatchpointOptions::WatchpointOptions(const WatchpointOptions &rhs) + : m_callback(rhs.m_callback), m_callback_baton_sp(rhs.m_callback_baton_sp), + m_callback_is_synchronous(rhs.m_callback_is_synchronous), + m_thread_spec_ap() { + if (rhs.m_thread_spec_ap.get() != nullptr) + m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get())); } //---------------------------------------------------------------------- // WatchpointOptions assignment operator //---------------------------------------------------------------------- -const WatchpointOptions& -WatchpointOptions::operator=(const WatchpointOptions& rhs) -{ - 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() != nullptr) - m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get())); - return *this; +const WatchpointOptions &WatchpointOptions:: +operator=(const WatchpointOptions &rhs) { + 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() != nullptr) + m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get())); + return *this; } WatchpointOptions * -WatchpointOptions::CopyOptionsNoCallback (WatchpointOptions &orig) -{ - WatchpointHitCallback orig_callback = orig.m_callback; - lldb::BatonSP orig_callback_baton_sp = orig.m_callback_baton_sp; - bool orig_is_sync = orig.m_callback_is_synchronous; - - orig.ClearCallback(); - WatchpointOptions *ret_val = new WatchpointOptions(orig); - - orig.SetCallback (orig_callback, orig_callback_baton_sp, orig_is_sync); - - return ret_val; +WatchpointOptions::CopyOptionsNoCallback(WatchpointOptions &orig) { + WatchpointHitCallback orig_callback = orig.m_callback; + lldb::BatonSP orig_callback_baton_sp = orig.m_callback_baton_sp; + bool orig_is_sync = orig.m_callback_is_synchronous; + + orig.ClearCallback(); + WatchpointOptions *ret_val = new WatchpointOptions(orig); + + orig.SetCallback(orig_callback, orig_callback_baton_sp, orig_is_sync); + + return ret_val; } //---------------------------------------------------------------------- @@ -91,147 +83,117 @@ WatchpointOptions::~WatchpointOptions() = default; //------------------------------------------------------------------ // Callbacks //------------------------------------------------------------------ -void -WatchpointOptions::SetCallback (WatchpointHitCallback callback, const BatonSP &callback_baton_sp, bool callback_is_synchronous) -{ - m_callback_is_synchronous = callback_is_synchronous; - m_callback = callback; - m_callback_baton_sp = callback_baton_sp; +void WatchpointOptions::SetCallback(WatchpointHitCallback callback, + const BatonSP &callback_baton_sp, + bool callback_is_synchronous) { + m_callback_is_synchronous = callback_is_synchronous; + m_callback = callback; + m_callback_baton_sp = callback_baton_sp; } -void -WatchpointOptions::ClearCallback () -{ - m_callback = WatchpointOptions::NullCallback; - m_callback_is_synchronous = false; - m_callback_baton_sp.reset(); +void WatchpointOptions::ClearCallback() { + m_callback = WatchpointOptions::NullCallback; + m_callback_is_synchronous = false; + m_callback_baton_sp.reset(); } -Baton * -WatchpointOptions::GetBaton () -{ - return m_callback_baton_sp.get(); -} +Baton *WatchpointOptions::GetBaton() { return m_callback_baton_sp.get(); } -const Baton * -WatchpointOptions::GetBaton () const -{ - return m_callback_baton_sp.get(); +const Baton *WatchpointOptions::GetBaton() const { + return m_callback_baton_sp.get(); } -bool -WatchpointOptions::InvokeCallback (StoppointCallbackContext *context, - lldb::user_id_t watch_id) -{ - if (m_callback && context->is_synchronous == IsCallbackSynchronous()) - { - return m_callback(m_callback_baton_sp ? m_callback_baton_sp->m_data : nullptr, - context, - watch_id); - } - else - return true; +bool WatchpointOptions::InvokeCallback(StoppointCallbackContext *context, + lldb::user_id_t watch_id) { + if (m_callback && context->is_synchronous == IsCallbackSynchronous()) { + return m_callback(m_callback_baton_sp ? m_callback_baton_sp->m_data + : nullptr, + context, watch_id); + } else + return true; } -bool -WatchpointOptions::HasCallback () -{ - return m_callback != WatchpointOptions::NullCallback; +bool WatchpointOptions::HasCallback() { + return m_callback != WatchpointOptions::NullCallback; } -const ThreadSpec * -WatchpointOptions::GetThreadSpecNoCreate () const -{ - return m_thread_spec_ap.get(); +const ThreadSpec *WatchpointOptions::GetThreadSpecNoCreate() const { + return m_thread_spec_ap.get(); } -ThreadSpec * -WatchpointOptions::GetThreadSpec () -{ - if (m_thread_spec_ap.get() == nullptr) - m_thread_spec_ap.reset (new ThreadSpec()); - - return m_thread_spec_ap.get(); +ThreadSpec *WatchpointOptions::GetThreadSpec() { + if (m_thread_spec_ap.get() == nullptr) + m_thread_spec_ap.reset(new ThreadSpec()); + + return m_thread_spec_ap.get(); } -void -WatchpointOptions::SetThreadID (lldb::tid_t thread_id) -{ - GetThreadSpec()->SetTID(thread_id); +void WatchpointOptions::SetThreadID(lldb::tid_t thread_id) { + GetThreadSpec()->SetTID(thread_id); } -void -WatchpointOptions::GetCallbackDescription (Stream *s, lldb::DescriptionLevel level) const -{ - if (m_callback_baton_sp.get()) - { - s->EOL(); - m_callback_baton_sp->GetDescription (s, level); - } +void WatchpointOptions::GetCallbackDescription( + Stream *s, lldb::DescriptionLevel level) const { + if (m_callback_baton_sp.get()) { + s->EOL(); + 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() != nullptr && GetThreadSpecNoCreate()->HasSpecification ())) - { - if (level == lldb::eDescriptionLevelVerbose) - { - s->EOL (); - s->IndentMore(); - s->Indent(); - s->PutCString("Watchpoint Options:\n"); - s->IndentMore(); - s->Indent(); - } - else - s->PutCString(" Options: "); - - if (m_thread_spec_ap.get()) - m_thread_spec_ap->GetDescription (s, level); - else if (level == eDescriptionLevelBrief) - s->PutCString ("thread spec: no "); - if (level == lldb::eDescriptionLevelFull) - { - s->IndentLess(); - s->IndentMore(); - } +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() != nullptr && + GetThreadSpecNoCreate()->HasSpecification())) { + if (level == lldb::eDescriptionLevelVerbose) { + s->EOL(); + s->IndentMore(); + s->Indent(); + s->PutCString("Watchpoint Options:\n"); + s->IndentMore(); + s->Indent(); + } else + s->PutCString(" Options: "); + + if (m_thread_spec_ap.get()) + m_thread_spec_ap->GetDescription(s, level); + else if (level == eDescriptionLevelBrief) + s->PutCString("thread spec: no "); + if (level == lldb::eDescriptionLevelFull) { + s->IndentLess(); + s->IndentMore(); } - - GetCallbackDescription(s, level); + } + + GetCallbackDescription(s, level); } -void -WatchpointOptions::CommandBaton::GetDescription (Stream *s, lldb::DescriptionLevel level) const -{ - CommandData *data = (CommandData *)m_data; +void WatchpointOptions::CommandBaton::GetDescription( + Stream *s, lldb::DescriptionLevel level) const { + CommandData *data = (CommandData *)m_data; - if (level == eDescriptionLevelBrief) - { - s->Printf (", commands = %s", (data && data->user_source.GetSize() > 0) ? "yes" : "no"); - return; - } - - s->IndentMore (); - s->Indent("watchpoint commands:\n"); - - s->IndentMore (); - if (data && data->user_source.GetSize() > 0) - { - const size_t num_strings = data->user_source.GetSize(); - for (size_t i = 0; i < num_strings; ++i) - { - s->Indent(data->user_source.GetStringAtIndex(i)); - s->EOL(); - } - } - else - { - s->PutCString ("No commands.\n"); + if (level == eDescriptionLevelBrief) { + s->Printf(", commands = %s", + (data && data->user_source.GetSize() > 0) ? "yes" : "no"); + return; + } + + s->IndentMore(); + s->Indent("watchpoint commands:\n"); + + s->IndentMore(); + if (data && data->user_source.GetSize() > 0) { + const size_t num_strings = data->user_source.GetSize(); + for (size_t i = 0; i < num_strings; ++i) { + s->Indent(data->user_source.GetStringAtIndex(i)); + s->EOL(); } - s->IndentLess (); - s->IndentLess (); + } else { + s->PutCString("No commands.\n"); + } + s->IndentLess(); + s->IndentLess(); } |