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

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 7 10:48:02 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4356aa20bcea: Reuse existing functionality in XcodeSDK::SDKSupportsModules (NFC) (authored by aprantl).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79533/new/

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.262697.patch
Type: text/x-patch
Size: 1255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200507/4420a691/attachment.bin>


More information about the lldb-commits mailing list