mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SymbolGraphGen] allow SourceKit to print declarations for private stdlib symbols (#64556)
Resolves rdar://103112656 Resolves #62457
This commit is contained in:
@@ -57,6 +57,12 @@ struct SymbolGraphOptions {
|
||||
/// along with "extensionTo" relationships instead of directly associating
|
||||
/// members and conformances with the extended nominal.
|
||||
bool EmitExtensionBlockSymbols = false;
|
||||
|
||||
/// Whether to print information for private symbols in the standard library.
|
||||
/// This should be left as `false` when printing a full-module symbol graph,
|
||||
/// but SourceKit should be able to load the information when pulling symbol
|
||||
/// information for individual queries.
|
||||
bool PrintPrivateStdlibSymbols = false;
|
||||
};
|
||||
|
||||
} // end namespace symbolgraphgen
|
||||
|
||||
@@ -63,8 +63,8 @@ PrintOptions SymbolGraph::getDeclarationFragmentsPrintOptions() const {
|
||||
Opts.PrintFunctionRepresentationAttrs =
|
||||
PrintOptions::FunctionRepresentationMode::None;
|
||||
Opts.PrintUserInaccessibleAttrs = false;
|
||||
Opts.SkipPrivateStdlibDecls = true;
|
||||
Opts.SkipUnderscoredStdlibProtocols = true;
|
||||
Opts.SkipPrivateStdlibDecls = !Walker.Options.PrintPrivateStdlibSymbols;
|
||||
Opts.SkipUnderscoredStdlibProtocols = !Walker.Options.PrintPrivateStdlibSymbols;
|
||||
Opts.PrintGenericRequirements = true;
|
||||
Opts.PrintInherited = false;
|
||||
Opts.ExplodeEnumCaseDecls = true;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
struct AnyError: Swift.Error {
|
||||
let error: Swift.Error
|
||||
}
|
||||
|
||||
func test(lhs: AnyError) {
|
||||
// RUN: %sourcekitd-test -req=cursor -req-opts=retrieve_symbol_graph=1 -pos=%(line + 1):13 %s -- %s | %FileCheck %s
|
||||
lhs.error._code
|
||||
}
|
||||
|
||||
// CHECK: SYMBOL GRAPH BEGIN
|
||||
|
||||
// CHECK: "declarationFragments": [
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "kind": "keyword",
|
||||
// CHECK-NEXT: "spelling": "var"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "kind": "text",
|
||||
// CHECK-NEXT: "spelling": " "
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "kind": "identifier",
|
||||
// CHECK-NEXT: "spelling": "_code"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "kind": "text",
|
||||
// CHECK-NEXT: "spelling": ": "
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "kind": "typeIdentifier",
|
||||
// CHECK-NEXT: "preciseIdentifier": "s:Si",
|
||||
// CHECK-NEXT: "spelling": "Int"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "kind": "text",
|
||||
// CHECK-NEXT: "spelling": " { "
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "kind": "keyword",
|
||||
// CHECK-NEXT: "spelling": "get"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "kind": "text",
|
||||
// CHECK-NEXT: "spelling": " }"
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: ]
|
||||
|
||||
// CHECK: SYMBOL GRAPH END
|
||||
@@ -1021,6 +1021,7 @@ fillSymbolInfo(CursorSymbolInfo &Symbol, const DeclInfo &DInfo,
|
||||
Options.MinimumAccessLevel = AccessLevel::Private;
|
||||
Options.IncludeSPISymbols = true;
|
||||
Options.IncludeClangDocs = true;
|
||||
Options.PrintPrivateStdlibSymbols = true;
|
||||
|
||||
symbolgraphgen::printSymbolGraphForDecl(DInfo.VD, DInfo.BaseType,
|
||||
DInfo.InSynthesizedExtension,
|
||||
|
||||
Reference in New Issue
Block a user