-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Frontend] Add a way to print features supported by the compiler #80833
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
base: main
Are you sure you want to change the base?
Conversation
swiftlang/swift-driver#1875 |
@swift-ci please test |
lib/Basic/SupportedFeatures.cpp
Outdated
out << " \"SupportedFeatures\": {\n"; | ||
out << " \"Upcoming\": [\n"; | ||
llvm::interleave(upcoming, printFeature, [&out] { out << ",\n"; }); | ||
out << "\n ],\n"; | ||
|
||
out << " \"Experimental\": [\n"; | ||
llvm::interleave(experimental, printFeature, [&out] { out << ",\n"; }); | ||
out << "\n ]\n"; | ||
|
||
out << " }\n"; | ||
out << "}\n"; |
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.
We are using both snake case and upper camel case for keys. Should we be consistent?
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.
Yeah, I was thinking maybe “feature_flags” maybe
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.
supported_features
or even just features
sounds fine to me too.
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.
Let's just go with "features".
lib/Basic/SupportedFeatures.cpp
Outdated
out << ", \"adoptable\": true"; | ||
} | ||
if (auto version = feature.getLanguageVersion()) { | ||
out << ", \"introduced_in\": " << *version; |
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.
This could be confused with when the feature was actually introduced. Maybe enabled_in
?
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 used the phrasing from the Features.def but don’t have a strong preference.
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.
It wasn't in Features.def it's in Features.h for Feature::getLanguageVersion()
.
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.
Changed to enabled_in
and adoptable
-> migratable
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.
cc @hborla
Migratable was my suggestion.
I added a test for |
8649e82
to
91e20ab
Compare
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please test macOS platform |
@swift-ci please test Linux platform |
This is a replacement for `-emit-supported-features` that prints all of the upcoming/experimental features supported by the compiler with some additional meta information in JSON format to stdout.
91e20ab
to
62d4b00
Compare
@swift-ci please clean test |
@swift-ci please test Linux platform |
1 similar comment
@swift-ci please test Linux platform |
swiftlang/swift-driver#1875 |
…ed-arguments` The "featues" part was never actually implemented and Swift Driver is replying on information about arguments, so instead of removing this mode, let's scope it down to "arguments" to be deprecated in the future.
62d4b00
to
18703d6
Compare
@swift-ci please test |
-emit-supported-features
with-emit-supported-arguments
mode because "features" part was never implemented.-print-supported-features
option that prints supported upcoming/experimental features and their metadata.