aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorMichał Górny <mgorny@moritz.systems>2022-08-05 19:39:42 +0200
committerMichał Górny <mgorny@moritz.systems>2022-08-08 17:34:27 +0200
commit9b031d5e3a7b455308257a71116a603e76c8c679 (patch)
tree8087466908ca913f45c4267b35c688c71e1e546c /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parente64025045457b7f52201fbd48b24739f64074b59 (diff)
downloadllvm-9b031d5e3a7b455308257a71116a603e76c8c679.zip
llvm-9b031d5e3a7b455308257a71116a603e76c8c679.tar.gz
llvm-9b031d5e3a7b455308257a71116a603e76c8c679.tar.bz2
[lldb] Make Process and subclass constructors protected
Make constructors of the Process and its subclasses class protected, to prevent accidentally constructing Process on stack when it could be afterwards accessed via a shared_ptr (since it uses std::enable_shared_from_this<>). The only place where a stack allocation was used were unittests, and fixing them via declaring an explicit public constructor in the respective mock classes is trivial. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D131275
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 233a665f6..30fb279 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -193,14 +193,13 @@ void ProcessGDBRemote::Terminate() {
PluginManager::UnregisterPlugin(ProcessGDBRemote::CreateInstance);
}
-lldb::ProcessSP
-ProcessGDBRemote::CreateInstance(lldb::TargetSP target_sp,
- ListenerSP listener_sp,
- const FileSpec *crash_file_path,
- bool can_connect) {
+lldb::ProcessSP ProcessGDBRemote::CreateInstance(
+ lldb::TargetSP target_sp, ListenerSP listener_sp,
+ const FileSpec *crash_file_path, bool can_connect) {
lldb::ProcessSP process_sp;
if (crash_file_path == nullptr)
- process_sp = std::make_shared<ProcessGDBRemote>(target_sp, listener_sp);
+ process_sp = std::shared_ptr<ProcessGDBRemote>(
+ new ProcessGDBRemote(target_sp, listener_sp));
return process_sp;
}