Author: Adrian Prantl Date: 2020-07-31T14:55:09-07:00 New Revision: 5110fd0343c2d06c8ae538741fbef13ece5e68de
URL: https://github.com/llvm/llvm-project/commit/5110fd0343c2d06c8ae538741fbef13ece5e68de DIFF: https://github.com/llvm/llvm-project/commit/5110fd0343c2d06c8ae538741fbef13ece5e68de.diff LOG: Convert to early exit (NFC) Added: Modified: lldb/source/Target/TargetList.cpp Removed: ################################################################################ diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 75a022d2c463..7e243e5ed338 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -394,37 +394,38 @@ Status TargetList::CreateTargetInternal(Debugger &debugger, target_sp.reset(new Target(debugger, arch, platform_sp, is_dummy_target)); } - if (target_sp) { - // Set argv0 with what the user typed, unless the user specified a - // directory. If the user specified a directory, then it is probably a - // bundle that was resolved and we need to use the resolved bundle path - if (!user_exe_path.empty()) { - // Use exactly what the user typed as the first argument when we exec or - // posix_spawn - if (user_exe_path_is_bundle && resolved_bundle_exe_path[0]) { - target_sp->SetArg0(resolved_bundle_exe_path); - } else { - // Use resolved path - target_sp->SetArg0(file.GetPath().c_str()); - } - } - if (file.GetDirectory()) { - FileSpec file_dir; - file_dir.GetDirectory() = file.GetDirectory(); - target_sp->AppendExecutableSearchPaths(file_dir); - } + if (!target_sp) + return error; - // Don't put the dummy target in the target list, it's held separately. - if (!is_dummy_target) { - std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex); - m_selected_target_idx = m_target_list.size(); - m_target_list.push_back(target_sp); - // Now prime this from the dummy target: - target_sp->PrimeFromDummyTarget(debugger.GetDummyTarget()); + // Set argv0 with what the user typed, unless the user specified a + // directory. If the user specified a directory, then it is probably a + // bundle that was resolved and we need to use the resolved bundle path + if (!user_exe_path.empty()) { + // Use exactly what the user typed as the first argument when we exec or + // posix_spawn + if (user_exe_path_is_bundle && resolved_bundle_exe_path[0]) { + target_sp->SetArg0(resolved_bundle_exe_path); } else { - m_dummy_target_sp = target_sp; + // Use resolved path + target_sp->SetArg0(file.GetPath().c_str()); } } + if (file.GetDirectory()) { + FileSpec file_dir; + file_dir.GetDirectory() = file.GetDirectory(); + target_sp->AppendExecutableSearchPaths(file_dir); + } + + // Don't put the dummy target in the target list, it's held separately. + if (!is_dummy_target) { + std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex); + m_selected_target_idx = m_target_list.size(); + m_target_list.push_back(target_sp); + // Now prime this from the dummy target: + target_sp->PrimeFromDummyTarget(debugger.GetDummyTarget()); + } else { + m_dummy_target_sp = target_sp; + } return error; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits