[Lldb-commits] [lldb] 4356aa2 - Reuse existing functionality in XcodeSDK::SDKSupportsModules (NFC)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Thu May 7 10:47:17 PDT 2020
Author: Adrian Prantl
Date: 2020-05-07T10:46:51-07:00
New Revision: 4356aa20bcea05b0f89c9977e41076552985f8c2
URL: https://github.com/llvm/llvm-project/commit/4356aa20bcea05b0f89c9977e41076552985f8c2
DIFF: https://github.com/llvm/llvm-project/commit/4356aa20bcea05b0f89c9977e41076552985f8c2.diff
LOG: Reuse existing functionality in XcodeSDK::SDKSupportsModules (NFC)
Differential Revision: https://reviews.llvm.org/D79533
Added:
Modified:
lldb/source/Utility/XcodeSDK.cpp
Removed:
################################################################################
diff --git a/lldb/source/Utility/XcodeSDK.cpp b/lldb/source/Utility/XcodeSDK.cpp
index 197eef182f69..fc1fc32b059c 100644
--- a/lldb/source/Utility/XcodeSDK.cpp
+++ b/lldb/source/Utility/XcodeSDK.cpp
@@ -182,25 +182,11 @@ bool XcodeSDK::SDKSupportsModules(XcodeSDK::Type desired_type,
const FileSpec &sdk_path) {
ConstString last_path_component = sdk_path.GetLastPathComponent();
- if (last_path_component) {
- const llvm::StringRef sdk_name = last_path_component.GetStringRef();
-
- const std::string sdk_name_lower = sdk_name.lower();
- Info info;
- info.type = desired_type;
- const std::string sdk_string = GetCanonicalName(info);
- if (!llvm::StringRef(sdk_name_lower).startswith(sdk_string))
- return false;
-
- auto version_part = sdk_name.drop_front(sdk_string.size());
- version_part.consume_back(".sdk");
- version_part.consume_back(".Internal");
-
- llvm::VersionTuple version;
- if (version.tryParse(version_part))
- return false;
- return SDKSupportsModules(desired_type, version);
- }
+ if (!last_path_component)
+ return false;
- return false;
+ XcodeSDK sdk(last_path_component.GetStringRef().str());
+ if (sdk.GetType() != desired_type)
+ return false;
+ return SDKSupportsModules(sdk.GetType(), sdk.GetVersion());
}
More information about the lldb-commits
mailing list