diff options
author | Zachary Turner <zturner@google.com> | 2016-09-13 17:53:38 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-09-13 17:53:38 +0000 |
commit | 4e4fbe821119fd168f3dd65fc88fa4220f6826fe (patch) | |
tree | a8766b18f241bc05bd31c01ab88d20a8f1c7e6cb /lldb/source/Commands/CommandObjectBreakpointCommand.cpp | |
parent | 8ea02f4e1c050e2bccac28439265656e8a2645c4 (diff) | |
download | llvm-4e4fbe821119fd168f3dd65fc88fa4220f6826fe.zip llvm-4e4fbe821119fd168f3dd65fc88fa4220f6826fe.tar.gz llvm-4e4fbe821119fd168f3dd65fc88fa4220f6826fe.tar.bz2 |
Some more pointer safety in Breakpoint.
Plumb unique_ptrs<> all the way through the baton interface.
NFC, this is a minor improvement to remove the possibility of an
accidental pointer ownership issue.
Reviewed By: jingham
Differential Revision: https://reviews.llvm.org/D24495
llvm-svn: 281360
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpointCommand.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectBreakpointCommand.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index 7884728..bf758b9 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)); } } |