[Lldb-commits] [PATCH] D79533: Reuse existing functionality in XcodeSDK::SDKSupportsModules (NFC)

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 6 18:12:26 PDT 2020


aprantl created this revision.
aprantl added a reviewer: JDevlieghere.

https://reviews.llvm.org/D79533

Files:
  lldb/source/Utility/XcodeSDK.cpp


Index: lldb/source/Utility/XcodeSDK.cpp
===================================================================
--- lldb/source/Utility/XcodeSDK.cpp
+++ lldb/source/Utility/XcodeSDK.cpp
@@ -182,25 +182,11 @@
                                   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());
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79533.262511.patch
Type: text/x-patch
Size: 1255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200507/222721a5/attachment.bin>


More information about the lldb-commits mailing list