mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
add new flag -symbol-graph-minimum-access-level
This commit is contained in:
@@ -1269,6 +1269,11 @@ def emit_symbol_graph_dir : Separate<["-"], "emit-symbol-graph-dir">,
|
||||
HelpText<"Emit a symbol graph to directory <dir>">,
|
||||
MetaVarName<"<dir>">;
|
||||
|
||||
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">,
|
||||
MetaVarName<"<level>">;
|
||||
|
||||
def pretty_print: Flag<["-"], "pretty-print">,
|
||||
Flags<[SwiftAPIExtractOption, SwiftSymbolGraphExtractOption]>,
|
||||
HelpText<"Pretty-print the output JSON">;
|
||||
|
||||
@@ -590,6 +590,7 @@ ToolChain::constructInvocation(const CompileJobAction &job,
|
||||
context.Args.AddLastArg(Arguments, options::OPT_emit_symbol_graph_dir);
|
||||
}
|
||||
context.Args.AddLastArg(Arguments, options::OPT_include_spi_symbols);
|
||||
context.Args.AddLastArg(Arguments, options::OPT_symbol_graph_minimum_access_level);
|
||||
|
||||
return II;
|
||||
}
|
||||
@@ -1081,6 +1082,7 @@ ToolChain::constructInvocation(const MergeModuleJobAction &job,
|
||||
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);
|
||||
context.Args.AddLastArg(Arguments, options::OPT_symbol_graph_minimum_access_level);
|
||||
|
||||
context.Args.AddLastArg(Arguments, options::OPT_import_objc_header);
|
||||
|
||||
|
||||
@@ -1104,8 +1104,20 @@ static void ParseSymbolGraphArgs(symbolgraphgen::SymbolGraphOptions &Opts,
|
||||
Opts.SkipInheritedDocs = Args.hasArg(OPT_skip_inherited_docs);
|
||||
Opts.IncludeSPISymbols = Args.hasArg(OPT_include_spi_symbols);
|
||||
|
||||
// default values for generating symbol graphs during a build
|
||||
if (auto *A = Args.getLastArg(OPT_symbol_graph_minimum_access_level)) {
|
||||
Opts.MinimumAccessLevel =
|
||||
llvm::StringSwitch<AccessLevel>(A->getValue())
|
||||
.Case("open", AccessLevel::Open)
|
||||
.Case("public", AccessLevel::Public)
|
||||
.Case("internal", AccessLevel::Internal)
|
||||
.Case("fileprivate", AccessLevel::FilePrivate)
|
||||
.Case("private", AccessLevel::Private)
|
||||
.Default(AccessLevel::Public);
|
||||
} else {
|
||||
Opts.MinimumAccessLevel = AccessLevel::Public;
|
||||
}
|
||||
|
||||
// default values for generating symbol graphs during a build
|
||||
Opts.PrettyPrint = false;
|
||||
Opts.EmitSynthesizedMembers = true;
|
||||
Opts.PrintMessages = false;
|
||||
|
||||
Reference in New Issue
Block a user