[SymbolGraph] Emit synthesized members

Emit copies of default implementations in protocol extensions and superclass declarations in conforming types and subclasses respectively using a virtual USR, i.e. `${REAL_USR}::SYNTHESIZED::${CONFORMING_OR_SUBCLASS_TYPE_USR}`.

- Add a -skip-synthesized-members option to skip these synthesized members.

- Create a new wrapping `Symbol` type that can also contain a base type declaration as well as the inherited declaration for those synthesized cases. Move some symbol-specific APIs there.

- Doc comments can “cascade” down to protocol extensions or refinements in concrete types. When emitting the doc comment for a symbol, look up through to superclasses or protocol requirements for where a doc comment is actually written.

- Clean up filtering of implicitly private (e.g. “public underscored”) types

rdar://problem/59128787
This commit is contained in:
Ashley Garland
2020-02-21 17:20:19 -08:00
parent 2e70d45afd
commit f0887fa245
27 changed files with 856 additions and 476 deletions

View File

@@ -63,6 +63,11 @@ SwiftVersion("swift-version", llvm::cl::desc("Interpret input according to a spe
static llvm::cl::opt<bool>
PrettyPrint("pretty-print", llvm::cl::desc("Pretty-print the resulting Symbol Graph JSON"), llvm::cl::cat(Category));
static llvm::cl::opt<bool>
SkipSynthesizedMembers("skip-synthesized-members",
llvm::cl::desc("Skip members inherited through classes or default implementations"),
llvm::cl::cat(Category));
static llvm::cl::opt<std::string>
MinimumAccessLevel("minimum-access-level", llvm::cl::desc("Include symbols with this access level or more"), llvm::cl::cat(Category));
@@ -171,6 +176,7 @@ int swift_symbolgraph_extract_main(ArrayRef<const char *> Args, const char *Argv
llvm::Triple(options::Target),
options::PrettyPrint,
AccessLevel::Public,
!options::SkipSynthesizedMembers,
};
if (!options::MinimumAccessLevel.empty()) {