mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SymbolGraph] Type subheadings: don't print generics/inheritance
Subheadings for types are treated more as a title element and can't be overloaded in the same way that other declarations can be. Abridge these fragments to only contain the keyword and identifier. rdar://62040714
This commit is contained in:
@@ -476,17 +476,22 @@ SymbolGraph::serializeSubheadingDeclarationFragments(StringRef Key,
|
||||
const Symbol &S,
|
||||
llvm::json::OStream &OS) {
|
||||
DeclarationFragmentPrinter Printer(OS, Key);
|
||||
auto Options = getDeclarationFragmentsPrintOptions();
|
||||
Options.ArgAndParamPrinting =
|
||||
PrintOptions::ArgAndParamPrintingMode::ArgumentOnly;
|
||||
Options.VarInitializers = false;
|
||||
Options.PrintDefaultArgumentValue = false;
|
||||
Options.PrintEmptyArgumentNames = false;
|
||||
Options.PrintOverrideKeyword = false;
|
||||
if (S.getSynthesizedBaseType()) {
|
||||
Options.setBaseType(S.getSynthesizedBaseType());
|
||||
|
||||
if (const auto *TD = dyn_cast<GenericTypeDecl>(S.getSymbolDecl())) {
|
||||
Printer.printAbridgedType(TD);
|
||||
} else {
|
||||
auto Options = getDeclarationFragmentsPrintOptions();
|
||||
Options.ArgAndParamPrinting =
|
||||
PrintOptions::ArgAndParamPrintingMode::ArgumentOnly;
|
||||
Options.VarInitializers = false;
|
||||
Options.PrintDefaultArgumentValue = false;
|
||||
Options.PrintEmptyArgumentNames = false;
|
||||
Options.PrintOverrideKeyword = false;
|
||||
if (S.getSynthesizedBaseType()) {
|
||||
Options.setBaseType(S.getSynthesizedBaseType());
|
||||
}
|
||||
S.getSymbolDecl()->print(Printer, Options);
|
||||
}
|
||||
S.getSymbolDecl()->print(Printer, Options);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user