mirror of
https://github.com/intel/llvm.git
synced 2026-01-24 16:34:22 +08:00
Use llvm::VersionTuple instead of manual version marshalling
Summary: This has multiple advantages: - we need only one function argument/instance variable instead of three - no need to default initialize variables - no custom parsing code - VersionTuple has comparison operators, which makes version comparisons much simpler Reviewers: zturner, friss, clayborg, jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D47889 llvm-svn: 334950
This commit is contained in:
@@ -330,27 +330,24 @@ const char *SBPlatform::GetHostname() {
|
||||
}
|
||||
|
||||
uint32_t SBPlatform::GetOSMajorVersion() {
|
||||
uint32_t major, minor, update;
|
||||
PlatformSP platform_sp(GetSP());
|
||||
if (platform_sp && platform_sp->GetOSVersion(major, minor, update))
|
||||
return major;
|
||||
return UINT32_MAX;
|
||||
llvm::VersionTuple version;
|
||||
if (PlatformSP platform_sp = GetSP())
|
||||
version = platform_sp->GetOSVersion();
|
||||
return version.empty() ? UINT32_MAX : version.getMajor();
|
||||
}
|
||||
|
||||
uint32_t SBPlatform::GetOSMinorVersion() {
|
||||
uint32_t major, minor, update;
|
||||
PlatformSP platform_sp(GetSP());
|
||||
if (platform_sp && platform_sp->GetOSVersion(major, minor, update))
|
||||
return minor;
|
||||
return UINT32_MAX;
|
||||
llvm::VersionTuple version;
|
||||
if (PlatformSP platform_sp = GetSP())
|
||||
version = platform_sp->GetOSVersion();
|
||||
return version.getMinor().getValueOr(UINT32_MAX);
|
||||
}
|
||||
|
||||
uint32_t SBPlatform::GetOSUpdateVersion() {
|
||||
uint32_t major, minor, update;
|
||||
PlatformSP platform_sp(GetSP());
|
||||
if (platform_sp && platform_sp->GetOSVersion(major, minor, update))
|
||||
return update;
|
||||
return UINT32_MAX;
|
||||
llvm::VersionTuple version;
|
||||
if (PlatformSP platform_sp = GetSP())
|
||||
version = platform_sp->GetOSVersion();
|
||||
return version.getSubminor().getValueOr(UINT32_MAX);
|
||||
}
|
||||
|
||||
SBError SBPlatform::Get(SBFileSpec &src, SBFileSpec &dst) {
|
||||
|
||||
Reference in New Issue
Block a user