Qualify the skip synthesized members option with symbol graph for the compiler frontend

Rollback the additional usages of the new options and test cases
This commit is contained in:
Chris McGee
2025-08-07 15:44:33 -04:00
parent 26168f57cc
commit 6a38bbe73d
6 changed files with 10 additions and 28 deletions

View File

@@ -573,12 +573,6 @@ public:
/// Whether to include symbols with SPI information in the symbol graph.
bool IncludeSPISymbolsInSymbolGraph = false;
/// Whether to pretty print the JSON output.
bool PrettyPrint = false;
///Whether to emit synthesized members in the JSON output.
bool EmitSynthesizedMembers = true;
/// Whether to reuse a frontend (i.e. compiler instance) for multiple
/// compilations. This prevents ASTContext being freed.
bool ReuseFrontendForMultipleCompilations = false;

View File

@@ -1779,6 +1779,10 @@ def emit_symbol_graph_dir : Separate<["-"], "emit-symbol-graph-dir">,
HelpText<"Emit a symbol graph to directory <dir>">,
MetaVarName<"<dir>">;
def symbol_graph_skip_synthesized_members: Flag<["-"], "symbol-graph-skip-synthesized-members">,
Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>,
HelpText<"Skip members inherited through classes or default implementations">;
def symbol_graph_minimum_access_level: Separate<["-"], "symbol-graph-minimum-access-level">,
Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>,
HelpText<"Include symbols with this access level or more when emitting a symbol graph">,
@@ -1839,7 +1843,7 @@ def experimental_allowed_reexported_modules: CommaJoined<["-"], "experimental-al
HelpText<"Allow reexporting symbols from the provided modules if they are themselves exported from the main module. This is a comma separated list of module names.">;
def skip_synthesized_members: Flag<[ "-" ], "skip-synthesized-members">,
Flags<[SwiftSymbolGraphExtractOption]>,
Flags<[NoDriverOption, SwiftSymbolGraphExtractOption]>,
HelpText<"Skip members inherited through classes or default implementations">;
def minimum_access_level : Separate<["-"], "minimum-access-level">,

View File

@@ -706,8 +706,6 @@ ToolChain::constructInvocation(const CompileJobAction &job,
context.Args.AddLastArg(Arguments, options::OPT_emit_extension_block_symbols,
options::OPT_omit_extension_block_symbols);
context.Args.AddLastArg(Arguments, options::OPT_symbol_graph_minimum_access_level);
context.Args.AddLastArg(Arguments, options::OPT_pretty_print);
context.Args.AddLastArg(Arguments, options::OPT_skip_synthesized_members);
return II;
}
@@ -1225,8 +1223,6 @@ ToolChain::constructInvocation(const MergeModuleJobAction &job,
addOutputsOfType(Arguments, context.Output, context.Args, file_types::TY_TBD,
"-emit-tbd-path");
context.Args.AddLastArg(Arguments, options::OPT_pretty_print);
context.Args.AddLastArg(Arguments, options::OPT_skip_synthesized_members);
context.Args.AddLastArg(Arguments, options::OPT_emit_symbol_graph);
context.Args.AddLastArg(Arguments, options::OPT_emit_symbol_graph_dir);
context.Args.AddLastArg(Arguments, options::OPT_include_spi_symbols);

View File

@@ -420,9 +420,6 @@ bool ArgsToFrontendOptionsConverter::convert(
Opts.SkipInheritedDocs = Args.hasArg(OPT_skip_inherited_docs);
Opts.IncludeSPISymbolsInSymbolGraph = Args.hasArg(OPT_include_spi_symbols);
Opts.PrettyPrint = Args.hasArg(OPT_pretty_print);
Opts.EmitSynthesizedMembers = !Args.hasArg(OPT_skip_synthesized_members);
Opts.Static = Args.hasArg(OPT_static);
Opts.HermeticSealAtLink = Args.hasArg(OPT_experimental_hermetic_seal_at_link);

View File

@@ -2258,7 +2258,7 @@ static void ParseSymbolGraphArgs(symbolgraphgen::SymbolGraphOptions &Opts,
OPT_omit_extension_block_symbols, /*default=*/false);
Opts.PrettyPrint = Args.hasArg(OPT_pretty_print);
Opts.EmitSynthesizedMembers = !Args.hasArg(OPT_skip_synthesized_members);
Opts.EmitSynthesizedMembers = !Args.hasArg(OPT_symbol_graph_skip_synthesized_members);
if (auto *A = Args.getLastArg(OPT_symbol_graph_minimum_access_level)) {
Opts.MinimumAccessLevel =

View File

@@ -33,12 +33,9 @@
// now run with -symbol-graph-minimum-access-level to change the available symbols
// RUN: %empty-directory(%t)
// -skip-synthesized-members
// RUN: %target-build-swift %s -module-name EmitWhileBuilding -emit-module -emit-module-path %t/EmitWhileBuilding.swiftmodule -pretty-print -skip-synthesized-members -emit-symbol-graph -emit-symbol-graph-dir %t/ -symbol-graph-minimum-access-level private
// RUN: %target-build-swift %s -module-name EmitWhileBuilding -emit-module -emit-module-path %t/EmitWhileBuilding.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ -symbol-graph-minimum-access-level private
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.symbols.json
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.symbols.json --check-prefix PRIV
// Check that the JSON has been pretty printed with some indented lines (FIXME - the pretty-print flag isn't working)
// RUN: cat %t/EmitWhileBuilding.symbols.json | jq | grep '^ '
/// Does a foo.
public func foo() {}
@@ -46,12 +43,6 @@ public func foo() {}
/// Does a bar.
func bar() {}
/// Has a compiler synthesized symbol
public struct Baz: Hashable {
let foo: Int
}
// CHECK: "precise": "s:17EmitWhileBuilding3fooyyF"
// PUB-NOT: "precise": "s:17EmitWhileBuilding3baryyF"
// PUB-NOT: "precise": "s:SQsE2neoiySbx_xtFZ::SYNTHESIZED::s:17EmitWhileBuilding3BazV",
// PRIV: "precise": "s:17EmitWhileBuilding3baryyF"
// CHECK: "precise":"s:17EmitWhileBuilding3fooyyF"
// PUB-NOT: "precise":"s:17EmitWhileBuilding3baryyF"
// PRIV: "precise":"s:17EmitWhileBuilding3baryyF"