Skip to content

[sourcekit] Use the driver to parse command line arguments #14366

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 3 commits into from
Feb 6, 2018

Conversation

benlangmuir
Copy link
Contributor

Stop parsing frontend arguments directly and use the driver instead. The most intersting part of this change is that it forces us to consider whether our compiler invocation will have inputs or not. We have several kinds of requests that need to create a compiler instance, but not parse any inputs (interface-generation, doc-info, and indexing when operating on a module instead of source files).

rdar://17897287

@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 2, 2018

Build failed
Swift Test OS X Platform
Git Sha - 32d1d420a0972f9ab0670a100e89bcb428b218d1

This will reduce test churn when we start using the driver to parse
arguments.  We don't really care what the module name is for these
fallback cases.
@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 2, 2018

Build failed
Swift Test OS X Platform
Git Sha - 32d1d420a0972f9ab0670a100e89bcb428b218d1

@swift-ci
Copy link
Contributor

swift-ci commented Feb 2, 2018

Build failed
Swift Test Linux Platform
Git Sha - 32d1d420a0972f9ab0670a100e89bcb428b218d1

Copy link
Contributor

@jrose-apple jrose-apple left a comment

Choose a reason for hiding this comment

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

Looks good from my end.

@benlangmuir
Copy link
Contributor Author

@swift-ci please test macOS platform

@swift-ci
Copy link
Contributor

swift-ci commented Feb 2, 2018

Build failed
Swift Test OS X Platform
Git Sha - f01d79ff6c9da6bb8a00f36588f523579c66ceb0

@benlangmuir
Copy link
Contributor Author

Updated tests: tests that use the built swift modules also need to pass a matching -target. Adding the target option exposed some other tests that had mac-specific output, so disabled those on other platforms. This is a symptom of the fact that the majority of our sourcekitd tests are really only running for the host platform, since they are not setting a target triple explicitly.

@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 3, 2018

Build failed
Swift Test OS X Platform
Git Sha - f01d79ff6c9da6bb8a00f36588f523579c66ceb0

@swift-ci
Copy link
Contributor

swift-ci commented Feb 3, 2018

Build failed
Swift Test Linux Platform
Git Sha - f01d79ff6c9da6bb8a00f36588f523579c66ceb0

These tests were relying on sourcekitd parsing as frontend instead of
using the driver.  Update them now to avoid churn when we fix command
line argument parsing in sourcekit.

The changes from clang-importer-sdk to clang-importer-sdk-nosource -I %t
are because clang-importer-sdk implies using -enable-source-import.
Rather than hack them up to use -Xfrontend, it is cleaner to just stop
using source import at all for these tests.  Incidentally, this improved
fidelity in a few places.  When using the generated swift modules we
also need to pass a target triple to sourcekit, which exposed some tests
that had mac-specific data.  This is a systemic issue for sourcekit
tests, but for now just make those few specific tests that we had
problems with run only on mac.
@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 5, 2018

Build failed
Swift Test Linux Platform
Git Sha - a73b35f3eb69005297cca0e761562bebd0ad55bf

@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 5, 2018

Build failed
Swift Test Linux Platform
Git Sha - 8e949db0f9eb1abcc90a2b45a71c0d5cfb2fdbaf

@swift-ci
Copy link
Contributor

swift-ci commented Feb 5, 2018

Build failed
Swift Test OS X Platform
Git Sha - a73b35f3eb69005297cca0e761562bebd0ad55bf

Stop parsing frontend arguments directly and use the driver instead. The
most intersting part of this change is that it forces us to consider
whether our compiler invocation will have inputs or not.  We have
several kinds of requests that need to create a compiler instance, but
not parse any inputs (interface-generation, doc-info, and indexing when
operating on a module instead of source files).

Incidentally, add an error when trying to do doc-info on multiple source
files. This was already very broken (assertion failures and bogus source
locations), so add an error for it.

rdar://problem/17897287
@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 5, 2018

Build failed
Swift Test Linux Platform
Git Sha - 8e949db0f9eb1abcc90a2b45a71c0d5cfb2fdbaf

@swift-ci
Copy link
Contributor

swift-ci commented Feb 5, 2018

Build failed
Swift Test OS X Platform
Git Sha - 8e949db0f9eb1abcc90a2b45a71c0d5cfb2fdbaf

@benlangmuir benlangmuir merged commit c035333 into swiftlang:master Feb 6, 2018
@benlangmuir benlangmuir deleted the sourcekit-driver branch February 6, 2018 18:16
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.

3 participants