Skip to content

Commit 3d5dc9b

Browse files
authored
Merge pull request #84212 from cmcgee1024/add_skip_inherited_docs
Add symbol graph option for skipping inherited docs
2 parents 8c5acc0 + d4ae4c3 commit 3d5dc9b

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift %s -module-name SkipInheritedDocs -emit-module-path %t/SkipInheritedDocs.swiftmodule
3+
// RUN: %target-swift-symbolgraph-extract -module-name SkipInheritedDocs -I %t -pretty-print -skip-inherited-docs -output-dir %t
4+
// RUN: %FileCheck %s --input-file %t/SkipInheritedDocs.symbols.json
5+
6+
/// Parent docs.
7+
public protocol P1 {
8+
/// Parent func docs.
9+
func p2()
10+
}
11+
12+
/// Child docs
13+
public class C1: P1 {
14+
public func p2() {}
15+
}
16+
17+
// CHECK: "Parent func docs."
18+
// CHECK-NOT: "Parent func docs."
19+

0 commit comments

Comments
 (0)