Skip to content

sdk: get clang resources from swift toolchain - #274

Merged
kabiroberai merged 1 commit into
mainfrom
clang-swift-toolchain
Sep 22, 2026
Merged

kabiroberai merged 1 commit into
mainfrom
clang-swift-toolchain

Conversation

@kabiroberai

@kabiroberai kabiroberai commented Sep 21, 2026

Copy link
Copy Markdown
Member

What does this PR do?

When building the SDK, derives the clang resource dir from the installed Swift toolchain (swiftc -print-target-info) instead of clang -print-resource-dir.

Speculatively fixes #273.

How was it tested?

Validated that I can still build on Linux

AI tool usage

How much of this PR was AI-assisted? (check one)

  • 0 - No AI was used to write code
  • 1 - I was assisted by AI. I reviewed the finished result.
  • 2 - I set the AI going and left it to it; nobody has read the result - no review, or AI review only

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of the host Clang resource directory by using Swift compiler target information, helping ensure more reliable compiler setup across supported environments.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5ff888cd-8a32-4f2c-b0dc-6f84dbd78b9e

📥 Commits

Reviewing files that changed from the base of the PR and between 04c29af and 476a7bb.

📒 Files selected for processing (1)
  • Sources/PackLib/DarwinSDK.swift

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

addHostClangResourceDir now runs the configured Swift compiler with -print-target-info, decodes its JSON output, and derives the host Clang resource directory from paths.runtimeResourcePath instead of querying clang.

Changes

SDK resource lookup

Layer / File(s) Summary
Swift target information lookup
Sources/PackLib/DarwinSDK.swift
addHostClangResourceDir now decodes Swift target information and appends clang to paths.runtimeResourcePath. The previous ToolRegistry lookup and clang -print-resource-dir parsing were removed.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change addresses issue #273. addHostClangResourceDir now runs the selected swiftc from BuildSettings.swiftcURL() with -print-target-info. It decodes paths.runtimeResourcePath and copies …
Out of Scope Changes check ✅ Passed The only changed file is Sources/PackLib/DarwinSDK.swift. The change replaces PATH-based Clang discovery with selected-Swift-toolchain discovery inside SDK installation. This directly supports issue…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: obtaining Clang resources from the Swift toolchain.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kabiroberai
kabiroberai marked this pull request as ready for review September 21, 2026 23:03
@kabiroberai
kabiroberai merged commit df1b6fa into main Sep 22, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK install copies PATH Clang 22 headers incompatible with Swift 6.4’s embedded Clang 21

1 participant