-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ClangImporter] clang's -iframework comes before builtin usr/local/include, but Swift's -Fsystem comes after #78303
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
[ClangImporter] clang's -iframework comes before builtin usr/local/include, but Swift's -Fsystem comes after #78303
Conversation
5b5c247
to
86aba97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is great. It's a significant improvement to have these be command-line flags, and to unify ClangImporter and ClandScanDeps config here. The SearchPath
unification cleans things up a bunch too. Thanks!
86aba97
to
613292a
Compare
😁 Is it a problem that this requires a lock-step lldb change? I can't come up with anything clever to avoid that since I can't overload |
Seems that an LLDB lockstep change is a lesser evil here, to me. |
613292a
to
60db7a0
Compare
60db7a0
to
336cb84
Compare
|
…clude, but Swift's -Fsystem comes after When Swift passes search paths to clang, it does so directly into the HeaderSearch. That means that those paths get ordered inconsistently compared to the equivalent clang flag, and causes inconsistencies when building clang modules with clang and with Swift. Instead of touching the HeaderSearch directly, pass Swift search paths as driver flags, just do them after the -Xcc ones. Swift doesn't have a way to pass a search path to clang as -isystem, only as -I which usually isn't the right flag. Add an -Isystem Swift flag so that those paths can be passed to clang as -isystem. rdar://93951328
336cb84
to
cdb42c3
Compare
@swift-ci smoke test |
// RUN: %target-swift-frontend -sdk %t/sdk -typecheck -I %t/sdk/custom/include -module-cache-path %t/mcp5 %t/SearchPathOrder.swift | ||
// RUN: %target-swift-frontend -sdk %t/sdk -typecheck -Isystem %t/sdk/custom/include -module-cache-path %t/mcp6 %t/SearchPathOrder.swift | ||
// RUN: %target-swift-frontend -sdk %t/sdk -typecheck -F %t/sdk/custom/Frameworks -module-cache-path %t/mcp7 %t/SearchPathOrder.swift | ||
// RUN: %target-swift-frontend -sdk %t/sdk -typecheck -Fsystem %t/sdk/custom/Frameworks -module-cache-path %t/mcp8 %t/SearchPathOrder.swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why, but this passes in main but fails in the current Xcode version. I'll have to double check this test when this builds into an Xcode to make sure this change fixes it.
When Swift passes search paths to clang, it does so directly into the HeaderSearch. That means that those paths get ordered inconsistently compared to the equivalent clang flag, and causes inconsistencies when building clang modules with clang and with Swift. Instead of touching the HeaderSearch directly, pass Swift search paths as driver flags, just do them after the -Xcc ones.
Swift doesn't have a way to pass a search path to clang as -isystem, only as -I which usually isn't the right flag. Add an -Isystem Swift flag so that those paths can be passed to clang as -isystem.
rdar://93951328