[Lldb-commits] [lldb] 43f8845 - [lldb] Fix build errors from 8b8070e23
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 22 05:29:52 PDT 2021
Author: Pavel Labath
Date: 2021-10-22T14:28:52+02:00
New Revision: 43f8845dd371a842841a19aad063b735ff0c9ec2
URL: https://github.com/llvm/llvm-project/commit/43f8845dd371a842841a19aad063b735ff0c9ec2
DIFF: https://github.com/llvm/llvm-project/commit/43f8845dd371a842841a19aad063b735ff0c9ec2.diff
LOG: [lldb] Fix build errors from 8b8070e23
I missed windows and openbsd.
Added:
Modified:
lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
lldb/source/Host/windows/HostInfoWindows.cpp
Removed:
################################################################################
diff --git a/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp b/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
index 9617375babe1f..18ffa381fbb4e 100644
--- a/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
+++ b/lldb/source/Host/openbsd/HostInfoOpenBSD.cpp
@@ -29,20 +29,16 @@ llvm::VersionTuple HostInfoOpenBSD::GetOSVersion() {
return llvm::VersionTuple();
}
-bool HostInfoOpenBSD::GetOSBuildString(std::string &s) {
+llvm::Optional<std::string> HostInfoOpenBSD::GetOSBuildString() {
int mib[2] = {CTL_KERN, KERN_OSREV};
char osrev_str[12];
uint32_t osrev = 0;
size_t osrev_len = sizeof(osrev);
- if (::sysctl(mib, 2, &osrev, &osrev_len, NULL, 0) == 0) {
- ::snprintf(osrev_str, sizeof(osrev_str), "%-8.8u", osrev);
- s.assign(osrev_str);
- return true;
- }
+ if (::sysctl(mib, 2, &osrev, &osrev_len, NULL, 0) == 0)
+ return llvm::formatv("{0,8:8}", osrev).str();
- s.clear();
- return false;
+ return llvm::None;
}
bool HostInfoOpenBSD::GetOSKernelDescription(std::string &s) {
diff --git a/lldb/source/Host/windows/HostInfoWindows.cpp b/lldb/source/Host/windows/HostInfoWindows.cpp
index 54a07b71b2cdf..1e6ce0ce5b2df 100644
--- a/lldb/source/Host/windows/HostInfoWindows.cpp
+++ b/lldb/source/Host/windows/HostInfoWindows.cpp
@@ -74,19 +74,18 @@ llvm::VersionTuple HostInfoWindows::GetOSVersion() {
info.wServicePackMajor);
}
-bool HostInfoWindows::GetOSBuildString(std::string &s) {
- s.clear();
+llvm::Optional<std::string> HostInfoWindows::GetOSBuildString() {
llvm::VersionTuple version = GetOSVersion();
if (version.empty())
- return false;
+ return llvm::None;
- llvm::raw_string_ostream stream(s);
- stream << "Windows NT " << version.getAsString();
- return true;
+ return "Windows NT " + version.getAsString();
}
bool HostInfoWindows::GetOSKernelDescription(std::string &s) {
- return GetOSBuildString(s);
+ llvm::Optional<std::string> build = GetOSBuildString();
+ s = build.getValueOr("");
+ return build.hasValue();
}
bool HostInfoWindows::GetHostname(std::string &s) {
More information about the lldb-commits
mailing list