diff options
author | Pavel Labath <pavel@labath.sk> | 2021-10-25 16:44:12 +0200 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2021-10-26 11:17:02 +0200 |
commit | 0a39a9c2cb43f93c82908cabdf73fdd4918a26e5 (patch) | |
tree | a1626b311bcd27f3cddd279d09c531499eef94a3 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | |
parent | 11a8423dab38293b75295bbb6a245bc8a829860f (diff) | |
download | llvm-0a39a9c2cb43f93c82908cabdf73fdd4918a26e5.zip llvm-0a39a9c2cb43f93c82908cabdf73fdd4918a26e5.tar.gz llvm-0a39a9c2cb43f93c82908cabdf73fdd4918a26e5.tar.bz2 |
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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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<std::string> 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__) |