[Lldb-commits] [PATCH] D81210: Teach GetXcodeSDK to look in the Xcode that contains LLDB

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 5 12:26:35 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG79daa3d89649: Teach GetXcodeSDK to look in the Xcode that contains LLDB (authored by aprantl).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81210

Files:
  lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm


Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
===================================================================
--- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -358,7 +358,21 @@
   XcodeSDK::Info info = sdk.Parse();
   std::string sdk_name = XcodeSDK::GetCanonicalName(info);
   auto find_sdk = [](std::string sdk_name) -> std::string {
-    std::string xcrun_cmd = "xcrun --show-sdk-path --sdk " + sdk_name;
+    std::string xcrun_cmd;
+    Environment env = Host::GetEnvironment();
+    std::string developer_dir = env.lookup("DEVELOPER_DIR");
+    if (developer_dir.empty())
+      if (FileSpec fspec = HostInfo::GetShlibDir())
+        if (FileSystem::Instance().Exists(fspec)) {
+          FileSpec path(
+              XcodeSDK::FindXcodeContentsDirectoryInPath(fspec.GetPath()));
+          if (path.RemoveLastPathComponent())
+            developer_dir = path.GetPath();
+        }
+    if (!developer_dir.empty())
+      xcrun_cmd = "/usr/bin/env DEVELOPER_DIR=\"" + developer_dir + "\" ";
+    xcrun_cmd += "xcrun --show-sdk-path --sdk " + sdk_name;
+
     int status = 0;
     int signo = 0;
     std::string output_str;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81210.268911.patch
Type: text/x-patch
Size: 1205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200605/5897d6fc/attachment.bin>


More information about the lldb-commits mailing list