From 1339b5e8ae6c28f08d20d0df93e5f21e79cf030e Mon Sep 17 00:00:00 2001 From: Oleksiy Vyalov Date: Thu, 13 Nov 2014 18:22:16 +0000 Subject: [PATCH] Refactor NativeProcessLinux::AttachToProcess in order to avoid reinterpret_cast from NativeProcessProtocol* to NativeProcessLinux*. llvm-svn: 221906 --- lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 4c53346..f13b715 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -1298,22 +1298,19 @@ NativeProcessLinux::AttachToProcess ( if (!error.Success ()) return error; - native_process_sp.reset (new NativeProcessLinux ()); + std::shared_ptr native_process_linux_sp (new NativeProcessLinux ()); - if (!native_process_sp->RegisterNativeDelegate (native_delegate)) + if (!native_process_linux_sp->RegisterNativeDelegate (native_delegate)) { - native_process_sp.reset (new NativeProcessLinux ()); error.SetErrorStringWithFormat ("failed to register the native delegate"); return error; } - reinterpret_cast (native_process_sp.get ())->AttachToInferior (pid, error); + native_process_linux_sp->AttachToInferior (pid, error); if (!error.Success ()) - { - native_process_sp.reset (); return error; - } + native_process_sp = native_process_linux_sp; return error; } -- 2.7.4