[Lldb-commits] [lldb] r351504 - Use llvm::VersionTuple instead of manual version marshalling

Brad Smith via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 17 17:36:59 PST 2019


Author: brad
Date: Thu Jan 17 17:36:58 2019
New Revision: 351504

URL: http://llvm.org/viewvc/llvm-project?rev=351504&view=rev
Log:
Use llvm::VersionTuple instead of manual version marshalling

Modified:
    lldb/trunk/include/lldb/Host/openbsd/HostInfoOpenBSD.h
    lldb/trunk/source/Host/openbsd/HostInfoOpenBSD.cpp

Modified: lldb/trunk/include/lldb/Host/openbsd/HostInfoOpenBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/openbsd/HostInfoOpenBSD.h?rev=351504&r1=351503&r2=351504&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/openbsd/HostInfoOpenBSD.h (original)
+++ lldb/trunk/include/lldb/Host/openbsd/HostInfoOpenBSD.h Thu Jan 17 17:36:58 2019
@@ -12,12 +12,13 @@
 
 #include "lldb/Host/posix/HostInfoPosix.h"
 #include "lldb/Utility/FileSpec.h"
+#include "llvm/Support/VersionTuple.h"
 
 namespace lldb_private {
 
 class HostInfoOpenBSD : public HostInfoPosix {
 public:
-  static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update);
+  static llvm::VersionTuple GetOSVersion();
   static bool GetOSBuildString(std::string &s);
   static bool GetOSKernelDescription(std::string &s);
   static FileSpec GetProgramFileSpec();

Modified: lldb/trunk/source/Host/openbsd/HostInfoOpenBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/openbsd/HostInfoOpenBSD.cpp?rev=351504&r1=351503&r2=351504&view=diff
==============================================================================
--- lldb/trunk/source/Host/openbsd/HostInfoOpenBSD.cpp (original)
+++ lldb/trunk/source/Host/openbsd/HostInfoOpenBSD.cpp Thu Jan 17 17:36:58 2019
@@ -17,16 +17,17 @@
 
 using namespace lldb_private;
 
-bool HostInfoOpenBSD::GetOSVersion(uint32_t &major, uint32_t &minor,
-                                   uint32_t &update) {
+llvm::VersionTuple HostInfoOpenBSD::GetOSVersion() {
   struct utsname un;
 
   ::memset(&un, 0, sizeof(utsname));
   if (uname(&un) < 0)
-    return false;
+    return llvm::VersionTuple();
 
-  int status = sscanf(un.release, "%u.%u", &major, &minor);
-  return status == 2;
+  unsigned major, minor;
+  if (2 == sscanf(un.release, "%u.%u", &major, &minor))
+    return llvm::VersionTuple(major, minor);
+  return llvm::VersionTuple();
 }
 
 bool HostInfoOpenBSD::GetOSBuildString(std::string &s) {




More information about the lldb-commits mailing list