Skip to content

Commit e71009b

Browse files
committed
Add symbol graph option for skipping inherited docs
1 parent 4468808 commit e71009b

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

include/swift/Option/Options.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,11 @@ def symbol_graph_pretty_print: Flag<["-"], "symbol-graph-pretty-print">,
17831783
Flags<[FrontendOption, NoInteractiveOption, HelpHidden, SupplementaryOutput]>,
17841784
HelpText<"Pretty-print the output symbol graph JSON">;
17851785

1786+
def symbol_graph_skip_inherited_docs: Flag<["-"], "symbol-graph-skip-inherited-docs">,
1787+
Flags<[FrontendOption, NoInteractiveOption, HelpHidden, SupplementaryOutput]>,
1788+
HelpText<"Skip emitting doc comments for members inherited through classes or "
1789+
"default implementations">;
1790+
17861791
def symbol_graph_skip_synthesized_members: Flag<["-"], "symbol-graph-skip-synthesized-members">,
17871792
Flags<[FrontendOption, NoInteractiveOption, HelpHidden, SupplementaryOutput]>,
17881793
HelpText<"Skip members inherited through classes or default implementations">;

lib/Driver/ToolChains.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ ToolChain::constructInvocation(const CompileJobAction &job,
707707
options::OPT_omit_extension_block_symbols);
708708
context.Args.AddLastArg(Arguments, options::OPT_symbol_graph_minimum_access_level);
709709
context.Args.AddLastArg(Arguments, options::OPT_symbol_graph_skip_synthesized_members);
710+
context.Args.AddLastArg(Arguments, options::OPT_symbol_graph_skip_inherited_docs);
710711
context.Args.AddLastArg(Arguments, options::OPT_symbol_graph_pretty_print);
711712

712713
return II;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,6 +2243,7 @@ static void ParseSymbolGraphArgs(symbolgraphgen::SymbolGraphOptions &Opts,
22432243
// default values for generating symbol graphs during a build
22442244
Opts.PrettyPrint = Args.hasArg(OPT_symbol_graph_pretty_print);
22452245
Opts.EmitSynthesizedMembers = !Args.hasArg(OPT_symbol_graph_skip_synthesized_members);
2246+
Opts.SkipInheritedDocs = !Args.hasArg(OPT_symbol_graph_skip_inherited_docs);
22462247
Opts.PrintMessages = false;
22472248
Opts.IncludeClangDocs = false;
22482249
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift %s -module-name SkipsInheritedDocs -emit-module -emit-module-path %t/
3+
// RUN: %target-swift-symbolgraph-extract -module-name SkipsInheritedDocs -I %t -pretty-print -skip-inherited-docs -output-dir %t
4+
// RUN: %FileCheck %s --input-file %t/SkipsInheritedDocs.symbols.json
5+
6+
// CHECK-NOT: houldappear
7+
8+
public class Parent {
9+
/// Parent foo docs
10+
func foo() { }
11+
}
12+
13+
public class ShouldAppear: Parent {
14+
/// Child foo docs
15+
func foo() { }
16+
}

0 commit comments

Comments
 (0)