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
diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
index 1cd253b..b576ce8 100644
--- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp
@@ -207,8 +207,8 @@
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 @@
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);
}