-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[6.2] [SymbolGraphGen] add flags to filter platforms out of availability metadata #80806
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
Conversation
…tadata (#80778) * add option to filter availability metadata in symbol graphs * filter out platform-specific availability in the stdlib docs rdar://144379124
@swift-ci Please test |
@swift-ci Please test macOS |
if (auto *A = ParsedArgs.getLastArg(OPT_allow_availability_platforms)) { | ||
llvm::SmallVector<StringRef> AvailabilityPlatforms; | ||
StringRef(A->getValue()) | ||
.split(AvailabilityPlatforms, ',', /*MaxSplits*/ -1, | ||
/*KeepEmpty*/ false); | ||
Options.AvailabilityPlatforms = llvm::DenseSet<StringRef>( | ||
AvailabilityPlatforms.begin(), AvailabilityPlatforms.end()); | ||
Options.AvailabilityIsBlockList = false; | ||
} else if (auto *A = | ||
ParsedArgs.getLastArg(OPT_block_availability_platforms)) { |
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.
The way this is written, it will take any "allow" even if there is a "block" coming later, which is unexpected. I'd recommend using the getLastArg form that takes both option names, so you get the last of either, and then set the Boolean based on which flag you got.
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 was wondering if there was a better way to go about it. Thanks for the suggestion! I can apply this here and forward-port it back to main afterward if that's okay.
lib/Frontend/CompilerInvocation.cpp
Outdated
@@ -2221,6 +2221,25 @@ static void ParseSymbolGraphArgs(symbolgraphgen::SymbolGraphOptions &Opts, | |||
Opts.MinimumAccessLevel = AccessLevel::Public; | |||
} | |||
|
|||
if (auto *A = Args.getLastArg(OPT_symbol_graph_allow_availability_platforms)) { |
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.
Same comment for this copy of the code.
# FIXME: swiftDarwin currently trips an assertion in SymbolGraphGen | ||
if (SWIFTLIB_IS_STDLIB AND SWIFT_STDLIB_BUILD_SYMBOL_GRAPHS AND NOT ${name} STREQUAL "swiftDarwin") | ||
# FIXME: swiftDarwin and swiftDifferentiationUnittest currently trip an assertion in SymbolGraphGen | ||
if (SWIFTLIB_IS_STDLIB AND SWIFT_STDLIB_BUILD_SYMBOL_GRAPHS AND NOT ${name} STREQUAL "swiftDarwin" |
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.
Yikes. I'm okay with extending this existing hack, but do we know what's going on here?
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 haven't had the opportunity to look into this. I assume there's some kind of construction that we're trying to handle incorrectly, but i have dug into what and why.
@swift-ci Please test |
--preview-stdlib-docs
functionality was tested at-desk.