-
Notifications
You must be signed in to change notification settings - Fork 193
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
[SR-13255] [swift-driver] Darwin-specific argument validation #1213
Comments
Comment by Nikhil (JIRA) owenvoorhees (JIRA User) I would like to work on this. Please guide me with starting steps. |
Comment by Owen Voorhees (JIRA) srinikhil07 (JIRA User) Hi! I'd recommend starting by checking out and building swift-driver if you haven't already and making sure you can run the tests. There are directions on how to do that in the README here: https://github.com/apple/swift-driver/blob/master/README.md. After that, if you take a look at the first link in description you'll see that there are three TODOs in DarwinToolchain.validateArguments that correspond to three validation steps the C++ driver is performing in the second link. Of those, `// TODO: Validating darwin unsupported -static-stdlib argument.` is probably the best starting point. This check emits a diagnostic if somebody passes the `-static-stdlib` argument to the driver when compiling for a Darwin platform (macOS/iOS/etc.), and can probably be included directly in DarwinToolchain.validateArguments. Once that's implemented, you should be able to add a test in SwiftDriverTests.swift which verifies the diagnostic is emitted. Feel free to let me know if you have any questions! The README also links to some other documentation about the driver that might be helpful. |
Comment by Nikhil (JIRA) owenvoorhees (JIRA User) Hi. Thanks for the steps. I could build the swift-driver, but any test I run I get the below error. Guess I am missing something, /Users/user/Code/driver-swift/swift-driver/Sources/SwiftDriver/Execution/DriverExecutor.swift:67: error: -[SwiftDriverTests.AssertDiagnosticsTests testAssertDriverDiagosotics] : failed: caught error: "keyNotFound(CodingKeys(stringValue: "compilerVersion", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: \"compilerVersion\", intValue: nil) (\"compilerVersion\").", underlyingError: nil))" I have done the three TODOs and wrote tests as well. I have to test them. |
Comment by Owen Voorhees (JIRA) srinikhil07 (JIRA User) That error usually occurs if swift-driver is finding an older Swift toolchain. To run the tests, I think you'll need to install a recent trunk snapshot from swift.org, or use a locally built swift. Then, you can use it in tests by setting the
|
Comment by Nikhil (JIRA) owenvoorhees (JIRA User) Please review #184 Do we have anything like clang-format for formatting Swift code here. Also, I am not sure where to ask, so I am asking here
//FIXME: This class is not thread-safe. Thanks. |
@owenv Could you see if we can close this (the associated pull request is merged)? Thanks. @shahmishal Could we transfer this issue to the swift-driver repo? |
Yes, this can be closed now, thanks for checking |
Additional Detail from JIRA
md5: fc54056e575ca013a03072c8d28f5400
Issue Description:
The current argument validation implementation specific to Darwin platforms (macOS, iOS, etc.) is incomplete. DarwinToolchain.validateArguments contains a number of TODOs for porting over validation steps from the C++ driver. The original implementation of these checks can be found here: https://github.com/apple/swift/blob/d3ecf8848ede62368896410ec6b891c1a34f2e4c/lib/Driver/DarwinToolChains.cpp#L932
The text was updated successfully, but these errors were encountered: