Skip to content
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

Sub CompilerInvocation should inherit '-D' when build swiftinterface to swiftmodule #64562

Closed
Fushj89 opened this issue Mar 23, 2023 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself legacy driver Area → compiler: the integrated C++ legacy driver. Succeeded by the swift-driver project swift 5.7 unexpected behavior Bug: Unexpected behavior or incorrect output

Comments

@Fushj89
Copy link
Contributor

Fushj89 commented Mar 23, 2023

Description

Compile a swift file which import swiftinterface file with not set -disable-implicit-swift-modules param, the swiftinterface file may import a clang module, the headers of clang module may has some logic depend on macros.

Because of sub CompilerInvocation did not inhert '-D' params when build swiftinterface file, ClangImporter will build clang module error.

'-D' means macros params, for example -Xcc -DDebug=1

Steps to reproduce

1、download SwiftIssue.zip
2、cd SwiftIssue
3、run build.sh in SwiftIssue

image

Expected behavior

compile success

Environment

  • Swift compiler version info: swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
  • Xcode version info: Xcode 14.2 Build version 14C18
  • Deployment target: arm64-apple-ios9.0

SwiftIssue.zip

@Fushj89 Fushj89 added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 23, 2023
@Fushj89
Copy link
Contributor Author

Fushj89 commented Mar 23, 2023

it seems has solved on XCode 14.3 RC with -strict-implicit-module-context flag.
But set -strict-implicit-module-context in Other Swift Flags when use XCode 14.3 RC, the -strict-implicit-module-context flag only pass to swiftc command,does not pass to swift-frontend command.

See #64564

@Fushj89 Fushj89 closed this as completed Jul 13, 2023
@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler itself legacy driver Area → compiler: the integrated C++ legacy driver. Succeeded by the swift-driver project unexpected behavior Bug: Unexpected behavior or incorrect output swift 5.7 and removed triage needed This issue needs more specific labels labels Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself legacy driver Area → compiler: the integrated C++ legacy driver. Succeeded by the swift-driver project swift 5.7 unexpected behavior Bug: Unexpected behavior or incorrect output
Projects
None yet
Development

No branches or pull requests

2 participants