From b1465fb9b2a6b4d5fd8c2e82f19aa3afee24090a Mon Sep 17 00:00:00 2001 From: Vera Mitchell Date: Thu, 10 Apr 2025 16:31:22 -0600 Subject: [PATCH 1/6] add option to filter availability metadata in symbol graphs --- include/swift/Option/Options.td | 20 +++++++++ .../swift/SymbolGraphGen/SymbolGraphOptions.h | 10 ++++- .../swift_symbolgraph_extract_main.cpp | 19 +++++++++ lib/Frontend/CompilerInvocation.cpp | 19 +++++++++ lib/SymbolGraphGen/Symbol.cpp | 22 ++++++++++ .../Availability/AvailabilityFilter.swift | 41 +++++++++++++++++++ 6 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td index c04a95a55484b..cabe47f89c89a 100644 --- a/include/swift/Option/Options.td +++ b/include/swift/Option/Options.td @@ -1774,6 +1774,16 @@ def symbol_graph_minimum_access_level: Separate<["-"], "symbol-graph-minimum-acc HelpText<"Include symbols with this access level or more when emitting a symbol graph">, MetaVarName<"">; +def symbol_graph_availability_platforms: Separate<["-"], "symbol-graph-availability-platforms">, + Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>, + HelpText<"Restrict availability metadata to the given platforms, e.g. 'macOS,swift'">, + MetaVarName<"">; + +def symbol_graph_block_availability_platforms: Separate<["-"], "symbol-graph-block-availability-platforms">, + Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>, + HelpText<"Remove the given platforms from symbol graph availability metadata, e.g. 'macOS,swift'">, + MetaVarName<"">; + def pretty_print: Flag<["-"], "pretty-print">, Flags<[SwiftSymbolGraphExtractOption]>, HelpText<"Pretty-print the output JSON">; @@ -1788,6 +1798,16 @@ def omit_extension_block_symbols: Flag<["-"], "omit-extension-block-symbols">, NoInteractiveOption, SupplementaryOutput, HelpHidden]>, HelpText<"Directly associate members and conformances with the extended nominal when generating symbol graphs instead of emitting 'swift.extension' symbols for extensions to external types">; +def availability_platforms: Separate<["-"], "availability-platforms">, + Flags<[SwiftSymbolGraphExtractOption]>, + HelpText<"Restrict availability metadata to the given platforms, e.g. 'macOS,swift'">, + MetaVarName<"">; + +def block_availability_platforms: Separate<["-"], "block-availability-platforms">, + Flags<[SwiftSymbolGraphExtractOption]>, + HelpText<"Remove the given platforms from symbol graph availability metadata, e.g. 'macOS,swift'">, + MetaVarName<"">; + // swift-synthesize-interface-only options def include_submodules : Flag<["-"], "include-submodules">, Flags<[NoDriverOption, SwiftSynthesizeInterfaceOption]>, diff --git a/include/swift/SymbolGraphGen/SymbolGraphOptions.h b/include/swift/SymbolGraphGen/SymbolGraphOptions.h index 168e345d4c4e3..179c2c142ded9 100644 --- a/include/swift/SymbolGraphGen/SymbolGraphOptions.h +++ b/include/swift/SymbolGraphGen/SymbolGraphOptions.h @@ -10,8 +10,9 @@ // //===----------------------------------------------------------------------===// -#include "llvm/TargetParser/Triple.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseSet.h" +#include "llvm/TargetParser/Triple.h" #include "swift/AST/AttrKind.h" @@ -69,6 +70,13 @@ struct SymbolGraphOptions { /// If this has a value specifies an explicit allow list of reexported module /// names that should be included symbol graph. std::optional> AllowedReexportedModules = {}; + + /// If set, a list of availability platforms to restrict (or block) when + /// rendering symbol graphs. + std::optional> AvailabilityPlatforms = {}; + + /// Whether `AvailabilityPlatforms` is an allow list or a block list. + bool AvailabilityIsBlockList = false; }; } // end namespace symbolgraphgen diff --git a/lib/DriverTool/swift_symbolgraph_extract_main.cpp b/lib/DriverTool/swift_symbolgraph_extract_main.cpp index 1dedd9bb72202..4d2c335113d77 100644 --- a/lib/DriverTool/swift_symbolgraph_extract_main.cpp +++ b/lib/DriverTool/swift_symbolgraph_extract_main.cpp @@ -203,6 +203,25 @@ int swift_symbolgraph_extract_main(ArrayRef Args, .Default(AccessLevel::Public); } + if (auto *A = ParsedArgs.getLastArg(OPT_availability_platforms)) { + llvm::SmallVector AvailabilityPlatforms; + StringRef(A->getValue()) + .split(AvailabilityPlatforms, ',', /*MaxSplits*/ -1, + /*KeepEmpty*/ false); + Options.AvailabilityPlatforms = llvm::DenseSet( + AvailabilityPlatforms.begin(), AvailabilityPlatforms.end()); + Options.AvailabilityIsBlockList = false; + } else if (auto *A = + ParsedArgs.getLastArg(OPT_block_availability_platforms)) { + llvm::SmallVector AvailabilityPlatforms; + StringRef(A->getValue()) + .split(AvailabilityPlatforms, ',', /*MaxSplits*/ -1, + /*KeepEmpty*/ false); + Options.AvailabilityPlatforms = llvm::DenseSet( + AvailabilityPlatforms.begin(), AvailabilityPlatforms.end()); + Options.AvailabilityIsBlockList = true; + } + Invocation.getLangOptions().setCxxInteropFromArgs(ParsedArgs, Diags); std::string InstanceSetupError; diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 08a02869acb83..d866d9a06e6e4 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -2221,6 +2221,25 @@ static void ParseSymbolGraphArgs(symbolgraphgen::SymbolGraphOptions &Opts, Opts.MinimumAccessLevel = AccessLevel::Public; } + if (auto *A = Args.getLastArg(OPT_symbol_graph_availability_platforms)) { + llvm::SmallVector AvailabilityPlatforms; + StringRef(A->getValue()) + .split(AvailabilityPlatforms, ',', /*MaxSplits*/ -1, + /*KeepEmpty*/ false); + Opts.AvailabilityPlatforms = llvm::DenseSet( + AvailabilityPlatforms.begin(), AvailabilityPlatforms.end()); + Opts.AvailabilityIsBlockList = false; + } else if (auto *A = Args.getLastArg( + OPT_symbol_graph_block_availability_platforms)) { + llvm::SmallVector AvailabilityPlatforms; + StringRef(A->getValue()) + .split(AvailabilityPlatforms, ',', /*MaxSplits*/ -1, + /*KeepEmpty*/ false); + Opts.AvailabilityPlatforms = llvm::DenseSet( + AvailabilityPlatforms.begin(), AvailabilityPlatforms.end()); + Opts.AvailabilityIsBlockList = true; + } + // default values for generating symbol graphs during a build Opts.PrettyPrint = false; Opts.EmitSynthesizedMembers = true; diff --git a/lib/SymbolGraphGen/Symbol.cpp b/lib/SymbolGraphGen/Symbol.cpp index 993c47bb8af54..a90e032f742c4 100644 --- a/lib/SymbolGraphGen/Symbol.cpp +++ b/lib/SymbolGraphGen/Symbol.cpp @@ -697,6 +697,28 @@ void Symbol::serializeAvailabilityMixin(llvm::json::OStream &OS) const { llvm::StringMap Availabilities; getInheritedAvailabilities(D, Availabilities); + // If we were asked to filter the availability platforms for the output graph, + // perform that filtering here. + if (Graph->Walker.Options.AvailabilityPlatforms) { + auto AvailabilityPlatforms = + Graph->Walker.Options.AvailabilityPlatforms.value(); + if (!AvailabilityPlatforms.empty()) { + if (Graph->Walker.Options.AvailabilityIsBlockList) { + for (const auto Availability : Availabilities.keys()) { + if (AvailabilityPlatforms.contains(Availability)) { + Availabilities.erase(Availability); + } + } + } else { + for (const auto Availability : Availabilities.keys()) { + if (!AvailabilityPlatforms.contains(Availability)) { + Availabilities.erase(Availability); + } + } + } + } + } + if (Availabilities.empty()) { return; } diff --git a/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift b/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift new file mode 100644 index 0000000000000..467a2d0aa562c --- /dev/null +++ b/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift @@ -0,0 +1,41 @@ +// RUN: %empty-directory(%t) +// RUN: %target-swift-frontend %s -module-name AvailabilityFilter -emit-module -emit-module-path %t/AvailabilityFilter.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ +// RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix DEFAULT + +// RUN: %target-swift-symbolgraph-extract -module-name AvailabilityFilter -I %t -pretty-print -output-dir %t +// RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix DEFAULT + +// Now checking the allowlist behavior... + +// RUN: %empty-directory(%t) +// RUN: %target-swift-frontend %s -module-name AvailabilityFilter -emit-module -emit-module-path %t/AvailabilityFilter.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ -symbol-graph-availability-platforms macOS,iOS +// RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix ALLOWLIST + +// RUN: %target-swift-symbolgraph-extract -module-name AvailabilityFilter -I %t -pretty-print -output-dir %t -availability-platforms macOS,iOS +// RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix ALLOWLIST + +// Now checking the blocklist behavior... + +// RUN: %empty-directory(%t) +// RUN: %target-swift-frontend %s -module-name AvailabilityFilter -emit-module -emit-module-path %t/AvailabilityFilter.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ -symbol-graph-block-availability-platforms macOS,iOS +// RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix BLOCKLIST + +// RUN: %target-swift-symbolgraph-extract -module-name AvailabilityFilter -I %t -pretty-print -output-dir %t -block-availability-platforms macOS,iOS +// RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix BLOCKLIST + +// REQUIRES: OS=macosx + +@available(macOS 11.0, iOS 15.0, watchOS 15.0, *) +public struct S {} + +// DEFAULT-DAG: macOS +// DEFAULT-DAG: iOS +// DEFAULT-DAG: watchOS + +// ALLOWLIST-NOT: watchOS +// ALLOWLIST-DAG: macOS +// ALLOWLIST-DAG: iOS + +// BLOCKLIST-NOT: macOS +// BLOCKLIST-NOT: iOS +// BLOCKLIST-DAG: watchOS From bf8c0c9a573c6b8fb74af7e0da0643483b9d2351 Mon Sep 17 00:00:00 2001 From: Vera Mitchell Date: Fri, 11 Apr 2025 13:32:02 -0600 Subject: [PATCH 2/6] filter out platform-specific availability in the stdlib docs rdar://144379124 --- stdlib/cmake/modules/AddSwiftStdlib.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stdlib/cmake/modules/AddSwiftStdlib.cmake b/stdlib/cmake/modules/AddSwiftStdlib.cmake index b149ee969517c..516a265a02341 100644 --- a/stdlib/cmake/modules/AddSwiftStdlib.cmake +++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake @@ -932,11 +932,14 @@ function(add_swift_target_library_single target name) endif() endif() - # 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" + AND NOT ${name} STREQUAL "swiftDifferentiationUnittest") list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS "-Xfrontend;-emit-symbol-graph") list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS "-Xfrontend;-emit-symbol-graph-dir;-Xfrontend;${out_lib_dir}/symbol-graph/${VARIANT_NAME}") + list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS + "-Xfrontend;-symbol-graph-availability-platforms;-Xfrontend;Swift") endif() if(MODULE) From e4e7c6d3124376a1c9f26cee4907b036aa0e5c01 Mon Sep 17 00:00:00 2001 From: Vera Mitchell Date: Fri, 11 Apr 2025 16:48:03 -0600 Subject: [PATCH 3/6] allow specifying an empty allow list --- lib/SymbolGraphGen/Symbol.cpp | 20 +++++++++---------- .../Availability/AvailabilityFilter.swift | 13 ++++++++++++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/lib/SymbolGraphGen/Symbol.cpp b/lib/SymbolGraphGen/Symbol.cpp index a90e032f742c4..e16018ff871e3 100644 --- a/lib/SymbolGraphGen/Symbol.cpp +++ b/lib/SymbolGraphGen/Symbol.cpp @@ -702,18 +702,16 @@ void Symbol::serializeAvailabilityMixin(llvm::json::OStream &OS) const { if (Graph->Walker.Options.AvailabilityPlatforms) { auto AvailabilityPlatforms = Graph->Walker.Options.AvailabilityPlatforms.value(); - if (!AvailabilityPlatforms.empty()) { - if (Graph->Walker.Options.AvailabilityIsBlockList) { - for (const auto Availability : Availabilities.keys()) { - if (AvailabilityPlatforms.contains(Availability)) { - Availabilities.erase(Availability); - } + if (Graph->Walker.Options.AvailabilityIsBlockList) { + for (const auto Availability : Availabilities.keys()) { + if (AvailabilityPlatforms.contains(Availability)) { + Availabilities.erase(Availability); } - } else { - for (const auto Availability : Availabilities.keys()) { - if (!AvailabilityPlatforms.contains(Availability)) { - Availabilities.erase(Availability); - } + } + } else { + for (const auto Availability : Availabilities.keys()) { + if (!AvailabilityPlatforms.contains(Availability)) { + Availabilities.erase(Availability); } } } diff --git a/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift b/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift index 467a2d0aa562c..9de4e7a9b54ed 100644 --- a/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift +++ b/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift @@ -23,6 +23,15 @@ // RUN: %target-swift-symbolgraph-extract -module-name AvailabilityFilter -I %t -pretty-print -output-dir %t -block-availability-platforms macOS,iOS // RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix BLOCKLIST +// Now test to ensure an empty allow list filters out all availability... + +// RUN: %empty-directory(%t) +// RUN: %target-swift-frontend %s -module-name AvailabilityFilter -emit-module -emit-module-path %t/AvailabilityFilter.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ -symbol-graph-availability-platforms "" +// RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix EMPTY + +// RUN: %target-swift-symbolgraph-extract -module-name AvailabilityFilter -I %t -pretty-print -output-dir %t -availability-platforms "" +// RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix EMPTY + // REQUIRES: OS=macosx @available(macOS 11.0, iOS 15.0, watchOS 15.0, *) @@ -39,3 +48,7 @@ public struct S {} // BLOCKLIST-NOT: macOS // BLOCKLIST-NOT: iOS // BLOCKLIST-DAG: watchOS + +// EMPTY-NOT: macOS +// EMPTY-NOT: iOS +// EMPTY-NOT: watchOS From 74c6d1e01216bf543a79135942171a651b33b220 Mon Sep 17 00:00:00 2001 From: Vera Mitchell Date: Fri, 11 Apr 2025 17:15:43 -0600 Subject: [PATCH 4/6] don't filter out universal availability info --- lib/SymbolGraphGen/Symbol.cpp | 4 ++-- .../Symbols/Mixins/Availability/AvailabilityFilter.swift | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/SymbolGraphGen/Symbol.cpp b/lib/SymbolGraphGen/Symbol.cpp index e16018ff871e3..10adbb6de68fc 100644 --- a/lib/SymbolGraphGen/Symbol.cpp +++ b/lib/SymbolGraphGen/Symbol.cpp @@ -704,13 +704,13 @@ void Symbol::serializeAvailabilityMixin(llvm::json::OStream &OS) const { Graph->Walker.Options.AvailabilityPlatforms.value(); if (Graph->Walker.Options.AvailabilityIsBlockList) { for (const auto Availability : Availabilities.keys()) { - if (AvailabilityPlatforms.contains(Availability)) { + if (Availability != "*" && AvailabilityPlatforms.contains(Availability)) { Availabilities.erase(Availability); } } } else { for (const auto Availability : Availabilities.keys()) { - if (!AvailabilityPlatforms.contains(Availability)) { + if (Availability != "*" && !AvailabilityPlatforms.contains(Availability)) { Availabilities.erase(Availability); } } diff --git a/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift b/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift index 9de4e7a9b54ed..64b5d2335b0b2 100644 --- a/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift +++ b/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift @@ -37,18 +37,27 @@ @available(macOS 11.0, iOS 15.0, watchOS 15.0, *) public struct S {} +/// Ensure that regardless of platforms being removed, that universal availability info, +/// like unconditional deprecation, still lands in the symbol graph. +@available(*, deprecated) +public class C {} + // DEFAULT-DAG: macOS // DEFAULT-DAG: iOS // DEFAULT-DAG: watchOS +// DEFAULT-DAG: "isUnconditionallyDeprecated":{{ ?}}true // ALLOWLIST-NOT: watchOS // ALLOWLIST-DAG: macOS // ALLOWLIST-DAG: iOS +// ALLOWLIST-DAG: "isUnconditionallyDeprecated":{{ ?}}true // BLOCKLIST-NOT: macOS // BLOCKLIST-NOT: iOS // BLOCKLIST-DAG: watchOS +// BLOCKLIST-DAG: "isUnconditionallyDeprecated":{{ ?}}true // EMPTY-NOT: macOS // EMPTY-NOT: iOS // EMPTY-NOT: watchOS +// EMPTY-DAG: "isUnconditionallyDeprecated":{{ ?}}true From 9f468dcb30d41847ca4e14a4ba4928e8f7b95d87 Mon Sep 17 00:00:00 2001 From: Vera Mitchell Date: Mon, 14 Apr 2025 11:08:38 -0600 Subject: [PATCH 5/6] review: rename allowlist flag to 'allow availability' --- include/swift/Option/Options.td | 4 ++-- lib/DriverTool/swift_symbolgraph_extract_main.cpp | 2 +- lib/Frontend/CompilerInvocation.cpp | 2 +- stdlib/cmake/modules/AddSwiftStdlib.cmake | 2 +- .../Symbols/Mixins/Availability/AvailabilityFilter.swift | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td index cabe47f89c89a..febe540130503 100644 --- a/include/swift/Option/Options.td +++ b/include/swift/Option/Options.td @@ -1774,7 +1774,7 @@ def symbol_graph_minimum_access_level: Separate<["-"], "symbol-graph-minimum-acc HelpText<"Include symbols with this access level or more when emitting a symbol graph">, MetaVarName<"">; -def symbol_graph_availability_platforms: Separate<["-"], "symbol-graph-availability-platforms">, +def symbol_graph_allow_availability_platforms: Separate<["-"], "symbol-graph-allow-availability-platforms">, Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>, HelpText<"Restrict availability metadata to the given platforms, e.g. 'macOS,swift'">, MetaVarName<"">; @@ -1798,7 +1798,7 @@ def omit_extension_block_symbols: Flag<["-"], "omit-extension-block-symbols">, NoInteractiveOption, SupplementaryOutput, HelpHidden]>, HelpText<"Directly associate members and conformances with the extended nominal when generating symbol graphs instead of emitting 'swift.extension' symbols for extensions to external types">; -def availability_platforms: Separate<["-"], "availability-platforms">, +def allow_availability_platforms: Separate<["-"], "allow-availability-platforms">, Flags<[SwiftSymbolGraphExtractOption]>, HelpText<"Restrict availability metadata to the given platforms, e.g. 'macOS,swift'">, MetaVarName<"">; diff --git a/lib/DriverTool/swift_symbolgraph_extract_main.cpp b/lib/DriverTool/swift_symbolgraph_extract_main.cpp index 4d2c335113d77..8648672cae9ee 100644 --- a/lib/DriverTool/swift_symbolgraph_extract_main.cpp +++ b/lib/DriverTool/swift_symbolgraph_extract_main.cpp @@ -203,7 +203,7 @@ int swift_symbolgraph_extract_main(ArrayRef Args, .Default(AccessLevel::Public); } - if (auto *A = ParsedArgs.getLastArg(OPT_availability_platforms)) { + if (auto *A = ParsedArgs.getLastArg(OPT_allow_availability_platforms)) { llvm::SmallVector AvailabilityPlatforms; StringRef(A->getValue()) .split(AvailabilityPlatforms, ',', /*MaxSplits*/ -1, diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index d866d9a06e6e4..d3698206435c6 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -2221,7 +2221,7 @@ static void ParseSymbolGraphArgs(symbolgraphgen::SymbolGraphOptions &Opts, Opts.MinimumAccessLevel = AccessLevel::Public; } - if (auto *A = Args.getLastArg(OPT_symbol_graph_availability_platforms)) { + if (auto *A = Args.getLastArg(OPT_symbol_graph_allow_availability_platforms)) { llvm::SmallVector AvailabilityPlatforms; StringRef(A->getValue()) .split(AvailabilityPlatforms, ',', /*MaxSplits*/ -1, diff --git a/stdlib/cmake/modules/AddSwiftStdlib.cmake b/stdlib/cmake/modules/AddSwiftStdlib.cmake index 516a265a02341..28829186bc4e4 100644 --- a/stdlib/cmake/modules/AddSwiftStdlib.cmake +++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake @@ -939,7 +939,7 @@ function(add_swift_target_library_single target name) list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS "-Xfrontend;-emit-symbol-graph-dir;-Xfrontend;${out_lib_dir}/symbol-graph/${VARIANT_NAME}") list(APPEND SWIFTLIB_SINGLE_SWIFT_COMPILE_FLAGS - "-Xfrontend;-symbol-graph-availability-platforms;-Xfrontend;Swift") + "-Xfrontend;-symbol-graph-allow-availability-platforms;-Xfrontend;Swift") endif() if(MODULE) diff --git a/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift b/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift index 64b5d2335b0b2..d09bca0c8ff4d 100644 --- a/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift +++ b/test/SymbolGraph/Symbols/Mixins/Availability/AvailabilityFilter.swift @@ -8,10 +8,10 @@ // Now checking the allowlist behavior... // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend %s -module-name AvailabilityFilter -emit-module -emit-module-path %t/AvailabilityFilter.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ -symbol-graph-availability-platforms macOS,iOS +// RUN: %target-swift-frontend %s -module-name AvailabilityFilter -emit-module -emit-module-path %t/AvailabilityFilter.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ -symbol-graph-allow-availability-platforms macOS,iOS // RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix ALLOWLIST -// RUN: %target-swift-symbolgraph-extract -module-name AvailabilityFilter -I %t -pretty-print -output-dir %t -availability-platforms macOS,iOS +// RUN: %target-swift-symbolgraph-extract -module-name AvailabilityFilter -I %t -pretty-print -output-dir %t -allow-availability-platforms macOS,iOS // RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix ALLOWLIST // Now checking the blocklist behavior... @@ -26,10 +26,10 @@ // Now test to ensure an empty allow list filters out all availability... // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend %s -module-name AvailabilityFilter -emit-module -emit-module-path %t/AvailabilityFilter.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ -symbol-graph-availability-platforms "" +// RUN: %target-swift-frontend %s -module-name AvailabilityFilter -emit-module -emit-module-path %t/AvailabilityFilter.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ -symbol-graph-allow-availability-platforms "" // RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix EMPTY -// RUN: %target-swift-symbolgraph-extract -module-name AvailabilityFilter -I %t -pretty-print -output-dir %t -availability-platforms "" +// RUN: %target-swift-symbolgraph-extract -module-name AvailabilityFilter -I %t -pretty-print -output-dir %t -allow-availability-platforms "" // RUN: %FileCheck %s --input-file %t/AvailabilityFilter.symbols.json --check-prefix EMPTY // REQUIRES: OS=macosx From 8dbeae0a65e57827578faf115fdf1332cb592e1c Mon Sep 17 00:00:00 2001 From: Vera Mitchell Date: Mon, 14 Apr 2025 11:09:26 -0600 Subject: [PATCH 6/6] review: capitalize Swift in the arg docs --- include/swift/Option/Options.td | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/swift/Option/Options.td b/include/swift/Option/Options.td index febe540130503..9950f2bc4b6ea 100644 --- a/include/swift/Option/Options.td +++ b/include/swift/Option/Options.td @@ -1776,12 +1776,12 @@ def symbol_graph_minimum_access_level: Separate<["-"], "symbol-graph-minimum-acc def symbol_graph_allow_availability_platforms: Separate<["-"], "symbol-graph-allow-availability-platforms">, Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>, - HelpText<"Restrict availability metadata to the given platforms, e.g. 'macOS,swift'">, + HelpText<"Restrict availability metadata to the given platforms, e.g. 'macOS,Swift'">, MetaVarName<"">; def symbol_graph_block_availability_platforms: Separate<["-"], "symbol-graph-block-availability-platforms">, Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>, - HelpText<"Remove the given platforms from symbol graph availability metadata, e.g. 'macOS,swift'">, + HelpText<"Remove the given platforms from symbol graph availability metadata, e.g. 'macOS,Swift'">, MetaVarName<"">; def pretty_print: Flag<["-"], "pretty-print">, @@ -1800,12 +1800,12 @@ def omit_extension_block_symbols: Flag<["-"], "omit-extension-block-symbols">, def allow_availability_platforms: Separate<["-"], "allow-availability-platforms">, Flags<[SwiftSymbolGraphExtractOption]>, - HelpText<"Restrict availability metadata to the given platforms, e.g. 'macOS,swift'">, + HelpText<"Restrict availability metadata to the given platforms, e.g. 'macOS,Swift'">, MetaVarName<"">; def block_availability_platforms: Separate<["-"], "block-availability-platforms">, Flags<[SwiftSymbolGraphExtractOption]>, - HelpText<"Remove the given platforms from symbol graph availability metadata, e.g. 'macOS,swift'">, + HelpText<"Remove the given platforms from symbol graph availability metadata, e.g. 'macOS,Swift'">, MetaVarName<"">; // swift-synthesize-interface-only options