diff options
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpointCommand.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectWatchpointCommand.cpp | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index 7884728e478..bf758b93ae5 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -24,6 +24,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include "llvm/ADT/STLExtras.h" + using namespace lldb; using namespace lldb_private; @@ -215,10 +217,9 @@ are no syntax errors may indicate that a function was declared but never called. if (!bp_options) continue; - BreakpointOptions::CommandData *cmd_data = - new BreakpointOptions::CommandData(); + auto cmd_data = llvm::make_unique<BreakpointOptions::CommandData>(); cmd_data->user_source.SplitIntoLines(line.c_str(), line.size()); - bp_options->SetCommandDataCallback(cmd_data); + bp_options->SetCommandDataCallback(std::move(cmd_data)); } } @@ -238,8 +239,7 @@ are no syntax errors may indicate that a function was declared but never called. SetBreakpointCommandCallback(std::vector<BreakpointOptions *> &bp_options_vec, const char *oneliner) { for (auto bp_options : bp_options_vec) { - BreakpointOptions::CommandData *cmd_data = - new BreakpointOptions::CommandData(); + auto cmd_data = llvm::make_unique<BreakpointOptions::CommandData>(); // It's necessary to set both user_source and script_source to the // oneliner. @@ -251,7 +251,7 @@ are no syntax errors may indicate that a function was declared but never called. cmd_data->script_source.assign(oneliner); cmd_data->stop_on_error = m_options.m_stop_on_error; - bp_options->SetCommandDataCallback(cmd_data); + bp_options->SetCommandDataCallback(std::move(cmd_data)); } } diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp index 1cd253bf89e..b576ce8b2f8 100644 --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -207,8 +207,8 @@ are no syntax errors may indicate that a function was declared but never called. new WatchpointOptions::CommandData()); if (data_ap) { data_ap->user_source.SplitIntoLines(line); - BatonSP baton_sp( - new WatchpointOptions::CommandBaton(data_ap.release())); + auto baton_sp = std::make_shared<WatchpointOptions::CommandBaton>( + std::move(data_ap)); wp_options->SetCallback(WatchpointOptionsCallbackFunction, baton_sp); } } @@ -239,7 +239,8 @@ are no syntax errors may indicate that a function was declared but never called. data_ap->script_source.assign(oneliner); data_ap->stop_on_error = m_options.m_stop_on_error; - BatonSP baton_sp(new WatchpointOptions::CommandBaton(data_ap.release())); + auto baton_sp = + std::make_shared<WatchpointOptions::CommandBaton>(std::move(data_ap)); wp_options->SetCallback(WatchpointOptionsCallbackFunction, baton_sp); } |