From 0a39a9c2cb43f93c82908cabdf73fdd4918a26e5 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 25 Oct 2021 16:44:12 +0200 Subject: Modernize and simplify HostInfo::GetOSKernelDescription Replace bool+by-ref argument with llvm::Optional, and move the common implementation into HostInfoPOSIX. Based on my (simple) experiment, the uname and the sysctl approach return the same value on MacOS, so there's no need for a mac-specific implementation of this functionality. Differential Revision: https://reviews.llvm.org/D112457 --- .../Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp') diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp index 17b7f17..15a1f0e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -272,13 +272,13 @@ GDBRemoteCommunicationServerCommon::Handle_qHostInfo( response.PutStringAsRawHex8(*s); response.PutChar(';'); } - std::string s; - if (HostInfo::GetOSKernelDescription(s)) { + if (llvm::Optional s = HostInfo::GetOSKernelDescription()) { response.PutCString("os_kernel:"); - response.PutStringAsRawHex8(s); + response.PutStringAsRawHex8(*s); response.PutChar(';'); } + std::string s; #if defined(__APPLE__) #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) -- cgit v1.1