Skip to content

Fix the DEVELOPER_DIR computation #70528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2023
Merged

Conversation

adrian-prantl
Copy link
Collaborator

The code was incorrectly going into the wrong direction by removing one component instead of appendeing /Developer to it. Due to fallback mechanisms in xcrun this never seemed to have caused any issues.

The code was incorrectly going into the wrong direction by removing
one component instead of appendeing /Developer to it. Due to fallback
mechanisms in xcrun this never seemed to have caused any issues.
@llvmbot
Copy link
Member

llvmbot commented Oct 28, 2023

@llvm/pr-subscribers-lldb

Author: Adrian Prantl (adrian-prantl)

Changes

The code was incorrectly going into the wrong direction by removing one component instead of appendeing /Developer to it. Due to fallback mechanisms in xcrun this never seemed to have caused any issues.


Full diff: https://github.com/llvm/llvm-project/pull/70528.diff

1 Files Affected:

  • (modified) lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm (+5-7)
diff --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index e3506a01c606b78..33d94504fe70f8c 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -461,13 +461,11 @@ static void ParseOSVersion(llvm::VersionTuple &version, NSString *Key) {
     // Invoke xcrun with the shlib dir.
     if (FileSpec fspec = HostInfo::GetShlibDir()) {
       if (FileSystem::Instance().Exists(fspec)) {
-        std::string contents_dir =
-            XcodeSDK::FindXcodeContentsDirectoryInPath(fspec.GetPath());
-        llvm::StringRef shlib_developer_dir =
-            llvm::sys::path::parent_path(contents_dir);
-        if (!shlib_developer_dir.empty()) {
-          auto sdk =
-              xcrun(sdk_name, show_sdk_path, std::move(shlib_developer_dir));
+        llvm::SmallString<0> shlib_developer_dir(
+            XcodeSDK::FindXcodeContentsDirectoryInPath(fspec.GetPath()));
+        llvm::sys::path::append(shlib_developer_dir, "Developer");
+        if (FileSystem::Instance().Exists(shlib_developer_dir)) {
+          auto sdk = xcrun(sdk_name, show_sdk_path, shlib_developer_dir);
           if (!sdk)
             return sdk.takeError();
           if (!sdk->empty())

Copy link
Member

@bulbazord bulbazord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me

@adrian-prantl adrian-prantl merged commit c42b640 into llvm:main Oct 30, 2023
adrian-prantl added a commit to adrian-prantl/llvm-project that referenced this pull request Oct 30, 2023
The code was incorrectly going into the wrong direction by removing one
component instead of appendeing /Developer to it. Due to fallback
mechanisms in xcrun this never seemed to have caused any issues.

(cherry picked from commit c42b640)
adrian-prantl added a commit to adrian-prantl/llvm-project that referenced this pull request Oct 30, 2023
The code was incorrectly going into the wrong direction by removing one
component instead of appendeing /Developer to it. Due to fallback
mechanisms in xcrun this never seemed to have caused any issues.

(cherry picked from commit c42b640)
adrian-prantl added a commit to swiftlang/llvm-project that referenced this pull request Oct 30, 2023
…-5.10-Fix-the-DEVELOPER_DIR-computation-70528

[Cherry-pick into swift/release/5.10] Fix the DEVELOPER_DIR computation (llvm#70528)
adrian-prantl added a commit to swiftlang/llvm-project that referenced this pull request Oct 30, 2023
…25-Fix-the-DEVELOPER_DIR-computation-70528

[Cherry-pick into stable/20230725] Fix the DEVELOPER_DIR computation (llvm#70528)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants