[Lldb-commits] [PATCH] D104093: [lldb] Move once_flags in HostInfoLinux so the internal state struct
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 10 23:54:07 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG632cbcac7906: [lldb] Move once_flags in HostInfoLinux so the internal state struct (authored by teemperor).
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104093/new/
https://reviews.llvm.org/D104093
Files:
lldb/source/Host/linux/HostInfoLinux.cpp
Index: lldb/source/Host/linux/HostInfoLinux.cpp
===================================================================
--- lldb/source/Host/linux/HostInfoLinux.cpp
+++ lldb/source/Host/linux/HostInfoLinux.cpp
@@ -26,7 +26,9 @@
namespace {
struct HostInfoLinuxFields {
+ llvm::once_flag m_distribution_once_flag;
std::string m_distribution_id;
+ llvm::once_flag m_os_version_once_flag;
llvm::VersionTuple m_os_version;
};
@@ -40,8 +42,8 @@
}
llvm::VersionTuple HostInfoLinux::GetOSVersion() {
- static llvm::once_flag g_once_flag;
- llvm::call_once(g_once_flag, []() {
+ assert(g_fields && "Missing call to Initialize?");
+ llvm::call_once(g_fields->m_os_version_once_flag, []() {
struct utsname un;
if (uname(&un) != 0)
return;
@@ -82,10 +84,10 @@
}
llvm::StringRef HostInfoLinux::GetDistributionId() {
+ assert(g_fields && "Missing call to Initialize?");
// Try to run 'lbs_release -i', and use that response for the distribution
// id.
- static llvm::once_flag g_once_flag;
- llvm::call_once(g_once_flag, []() {
+ llvm::call_once(g_fields->m_distribution_once_flag, []() {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST));
LLDB_LOGF(log, "attempting to determine Linux distribution...");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104093.351346.patch
Type: text/x-patch
Size: 1271 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210611/f87b6078/attachment.bin>
More information about the lldb-commits
mailing list