diff options
author | Pavel Labath <labath@google.com> | 2018-06-18 15:02:23 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-06-18 15:02:23 +0000 |
commit | 2272c4811f8d2c56612d483c2546f053e7ea61cc (patch) | |
tree | c591a7a541563c323f1b4f8697a8cd7b8ea53f8c /lldb/source/Utility/Args.cpp | |
parent | 13684d840019282ed720cd52a9a0e6c3485d3a76 (diff) | |
download | bcm5719-llvm-2272c4811f8d2c56612d483c2546f053e7ea61cc.tar.gz bcm5719-llvm-2272c4811f8d2c56612d483c2546f053e7ea61cc.zip |
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
Diffstat (limited to 'lldb/source/Utility/Args.cpp')
-rw-r--r-- | lldb/source/Utility/Args.cpp | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/lldb/source/Utility/Args.cpp b/lldb/source/Utility/Args.cpp index 16d6b719135..4f65cda56c7 100644 --- a/lldb/source/Utility/Args.cpp +++ b/lldb/source/Utility/Args.cpp @@ -409,29 +409,6 @@ const char *Args::StripSpaces(std::string &s, bool leading, bool trailing, return s.c_str(); } -bool Args::StringToVersion(llvm::StringRef string, uint32_t &major, - uint32_t &minor, uint32_t &update) { - major = UINT32_MAX; - minor = UINT32_MAX; - update = UINT32_MAX; - - if (string.empty()) - return false; - - llvm::StringRef major_str, minor_str, update_str; - - std::tie(major_str, minor_str) = string.split('.'); - std::tie(minor_str, update_str) = minor_str.split('.'); - if (major_str.getAsInteger(10, major)) - return false; - if (!minor_str.empty() && minor_str.getAsInteger(10, minor)) - return false; - if (!update_str.empty() && update_str.getAsInteger(10, update)) - return false; - - return true; -} - const char *Args::GetShellSafeArgument(const FileSpec &shell, const char *unsafe_arg, std::string &safe_arg) { |