[Lldb-commits] [lldb] [lldb][macOS] Recognize new layouts for DeviceSupport directories (PR #188646)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 26 07:18:39 PDT 2026


================
@@ -862,18 +862,33 @@ FileSpec PlatformDarwin::GetSDKDirectoryForModules(XcodeSDK::Type sdk_type) {
   return FindSDKInXcodeForModules(sdk_type, sdks_spec);
 }
 
+// Discovering the correct version and build can help us
+// identify the most likely SDK directory when looking for
+// files.
+//
+// The directory name can be one of many formats, such as
+//     10.0 (21R329) universal
+//     17.0 (23X1010104078) universal
+//     17.0 (23A200) arm64e
+//     17.0 (20A352)
+//     Watch4,2 10.0 (21R329)
+//     iPhone11,2 26.0 (23A276)
+//     iPhone13,2 17.0 (18C22)
 std::tuple<llvm::VersionTuple, llvm::StringRef>
 PlatformDarwin::ParseVersionBuildDir(llvm::StringRef dir) {
   llvm::StringRef build;
-  llvm::StringRef version_str;
-  llvm::StringRef build_str;
-  std::tie(version_str, build_str) = dir.split(' ');
   llvm::VersionTuple version;
-  if (!version.tryParse(version_str) ||
-      build_str.empty()) {
-    if (build_str.consume_front("(")) {
-      size_t pos = build_str.find(')');
-      build = build_str.slice(0, pos);
+
+  llvm::SmallVector<llvm::StringRef> parts;
+  dir.split(parts, ' ');
+  for (llvm::StringRef part : parts) {
+    // Look for an OS version number like "17.0"
+    if (isdigit(part[0]))
+      version.tryParse(part);
+    // Look for a build number "(20A352)"
----------------
JDevlieghere wrote:

```suggestion
    // Look for a build number. (e.g. "(20A352)")
```

https://github.com/llvm/llvm-project/pull/188646


More information about the lldb-commits mailing list