Skip to content

Commit 6a38bbe

Browse files
committed
Qualify the skip synthesized members option with symbol graph for the compiler frontend
Rollback the additional usages of the new options and test cases
1 parent 26168f5 commit 6a38bbe

File tree

6 files changed

+10
-28
lines changed

6 files changed

+10
-28
lines changed

include/swift/Frontend/FrontendOptions.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -573,12 +573,6 @@ class FrontendOptions {
573573
/// Whether to include symbols with SPI information in the symbol graph.
574574
bool IncludeSPISymbolsInSymbolGraph = false;
575575

576-
/// Whether to pretty print the JSON output.
577-
bool PrettyPrint = false;
578-
579-
///Whether to emit synthesized members in the JSON output.
580-
bool EmitSynthesizedMembers = true;
581-
582576
/// Whether to reuse a frontend (i.e. compiler instance) for multiple
583577
/// compilations. This prevents ASTContext being freed.
584578
bool ReuseFrontendForMultipleCompilations = false;

include/swift/Option/Options.td

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1779,6 +1779,10 @@ def emit_symbol_graph_dir : Separate<["-"], "emit-symbol-graph-dir">,
17791779
HelpText<"Emit a symbol graph to directory <dir>">,
17801780
MetaVarName<"<dir>">;
17811781

1782+
def symbol_graph_skip_synthesized_members: Flag<["-"], "symbol-graph-skip-synthesized-members">,
1783+
Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>,
1784+
HelpText<"Skip members inherited through classes or default implementations">;
1785+
17821786
def symbol_graph_minimum_access_level: Separate<["-"], "symbol-graph-minimum-access-level">,
17831787
Flags<[FrontendOption, NoInteractiveOption, SupplementaryOutput, HelpHidden]>,
17841788
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
18391843
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.">;
18401844

18411845
def skip_synthesized_members: Flag<[ "-" ], "skip-synthesized-members">,
1842-
Flags<[SwiftSymbolGraphExtractOption]>,
1846+
Flags<[NoDriverOption, SwiftSymbolGraphExtractOption]>,
18431847
HelpText<"Skip members inherited through classes or default implementations">;
18441848

18451849
def minimum_access_level : Separate<["-"], "minimum-access-level">,

lib/Driver/ToolChains.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,6 @@ ToolChain::constructInvocation(const CompileJobAction &job,
706706
context.Args.AddLastArg(Arguments, options::OPT_emit_extension_block_symbols,
707707
options::OPT_omit_extension_block_symbols);
708708
context.Args.AddLastArg(Arguments, options::OPT_symbol_graph_minimum_access_level);
709-
context.Args.AddLastArg(Arguments, options::OPT_pretty_print);
710-
context.Args.AddLastArg(Arguments, options::OPT_skip_synthesized_members);
711709

712710
return II;
713711
}
@@ -1225,8 +1223,6 @@ ToolChain::constructInvocation(const MergeModuleJobAction &job,
12251223
addOutputsOfType(Arguments, context.Output, context.Args, file_types::TY_TBD,
12261224
"-emit-tbd-path");
12271225

1228-
context.Args.AddLastArg(Arguments, options::OPT_pretty_print);
1229-
context.Args.AddLastArg(Arguments, options::OPT_skip_synthesized_members);
12301226
context.Args.AddLastArg(Arguments, options::OPT_emit_symbol_graph);
12311227
context.Args.AddLastArg(Arguments, options::OPT_emit_symbol_graph_dir);
12321228
context.Args.AddLastArg(Arguments, options::OPT_include_spi_symbols);

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,6 @@ bool ArgsToFrontendOptionsConverter::convert(
420420
Opts.SkipInheritedDocs = Args.hasArg(OPT_skip_inherited_docs);
421421
Opts.IncludeSPISymbolsInSymbolGraph = Args.hasArg(OPT_include_spi_symbols);
422422

423-
Opts.PrettyPrint = Args.hasArg(OPT_pretty_print);
424-
Opts.EmitSynthesizedMembers = !Args.hasArg(OPT_skip_synthesized_members);
425-
426423
Opts.Static = Args.hasArg(OPT_static);
427424

428425
Opts.HermeticSealAtLink = Args.hasArg(OPT_experimental_hermetic_seal_at_link);

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2258,7 +2258,7 @@ static void ParseSymbolGraphArgs(symbolgraphgen::SymbolGraphOptions &Opts,
22582258
OPT_omit_extension_block_symbols, /*default=*/false);
22592259

22602260
Opts.PrettyPrint = Args.hasArg(OPT_pretty_print);
2261-
Opts.EmitSynthesizedMembers = !Args.hasArg(OPT_skip_synthesized_members);
2261+
Opts.EmitSynthesizedMembers = !Args.hasArg(OPT_symbol_graph_skip_synthesized_members);
22622262

22632263
if (auto *A = Args.getLastArg(OPT_symbol_graph_minimum_access_level)) {
22642264
Opts.MinimumAccessLevel =

test/SymbolGraph/EmitWhileBuilding.swift

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,16 @@
3333
// now run with -symbol-graph-minimum-access-level to change the available symbols
3434

3535
// RUN: %empty-directory(%t)
36-
// -skip-synthesized-members
37-
// 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
36+
// 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
3837
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.symbols.json
3938
// RUN: %FileCheck %s --input-file %t/EmitWhileBuilding.symbols.json --check-prefix PRIV
40-
// Check that the JSON has been pretty printed with some indented lines (FIXME - the pretty-print flag isn't working)
41-
// RUN: cat %t/EmitWhileBuilding.symbols.json | jq | grep '^ '
4239

4340
/// Does a foo.
4441
public func foo() {}
4542

4643
/// Does a bar.
4744
func bar() {}
4845

49-
/// Has a compiler synthesized symbol
50-
public struct Baz: Hashable {
51-
let foo: Int
52-
}
53-
54-
// CHECK: "precise": "s:17EmitWhileBuilding3fooyyF"
55-
// PUB-NOT: "precise": "s:17EmitWhileBuilding3baryyF"
56-
// PUB-NOT: "precise": "s:SQsE2neoiySbx_xtFZ::SYNTHESIZED::s:17EmitWhileBuilding3BazV",
57-
// PRIV: "precise": "s:17EmitWhileBuilding3baryyF"
46+
// CHECK: "precise":"s:17EmitWhileBuilding3fooyyF"
47+
// PUB-NOT: "precise":"s:17EmitWhileBuilding3baryyF"
48+
// PRIV: "precise":"s:17EmitWhileBuilding3baryyF"

0 commit comments

Comments
 (0)