Commit Graph

213 Commits

Author SHA1 Message Date
Victoria Mitchell
3011a3cfca [SymbolGraphGen] don't emit access control attributes in declarations
rdar://85280786
2021-12-22 16:35:12 -07:00
Becca Royal-Gordon
1880118e70 Restructure getDisplayDecl() Sendable forcing
Move this into a helper function that lives in Sema, avoiding libswiftAST calling into libswiftSema.
2021-11-19 17:51:27 -08:00
Ben Barham
6aa3e0fd00 [SymbolGraph] Determine optional requirement by presence of OptionalAttr
Rather than checking the underlying ObjectiveC decl, use the presence of
`OptionalAttr` to determine if a requirement is optional instead. This
is already added by the importer when necessary. An added benefit here
is that this also works for optional requirements defined in Swift (ie.
`@objc optional ...`).
2021-09-25 11:50:53 +10:00
Rintaro Ishizaki
6e69a44c3d [ASTPrinter] Intorduce 'IntroducerKeyword' name kind
For more fine grained annoations. For now, it's handled as the same as
'Keyword' name kind.

Fix an issue where 'extension' wasn't marked as "keyword".

Also, move 'static' priting out of 'SkipIntroducerKeywords' guard
because 'static' is not an declaration introducer.
2021-07-29 12:50:24 -07:00
Robert Widmann
d86551de67 Lift Requirement and Parameter Accessors up to GenericSignature
Start treating the null {Can}GenericSignature as a regular signature
with no requirements and no parameters. This not only makes for a much
safer abstraction, but allows us to simplify a lot of the clients of
GenericSignature that would previously have to check for null before
using the abstraction.
2021-07-22 23:27:05 -07:00
Victoria Mitchell
dd39496098 do not synthesize subclass methods
rdar://80091081
2021-07-02 14:43:53 -06:00
Victoria Mitchell
183db81d12 rename symbol graph files for cross-import overlays
rdar://79474927
2021-06-22 16:50:34 -06:00
QuietMisdreavus
7277baa07b Merge pull request #37777 from apple/QuietMisdreavus/sourceOrigin-with-feeling
[SymbolGraph] add sourceOrigin info for all protocol implementations
2021-06-11 17:11:35 -06:00
Victoria Mitchell
703ebb6861 also add sourceOrigin for local protocols without docs 2021-06-07 09:07:28 -06:00
Victoria Mitchell
6f53e1dc04 add sourceOrigin info for all protocol implementations
rdar://78680450
2021-06-03 17:07:28 -06:00
Victoria Mitchell
d281722589 add symbol-graph flag to include SPI symbols
rdar://70794131
2021-05-20 15:10:49 -06:00
Victoria Mitchell
81bc80d565 add sourceOrigin field for symbols implementing remote protocol requirements
rdar://77626724
2021-05-10 16:41:50 -06:00
QuietMisdreavus
08d1c33e6f Merge pull request #37278 from apple/QuietMisdreavus/default-relation
[SymbolGraph] add "memberOf" relations for remote protocol implementations
2021-05-07 16:19:18 -06:00
QuietMisdreavus
4b068acf23 Merge pull request #37248 from apple/QuietMisdreavus/synthesized-sourceOrigin
[SymbolGraph] add sourceOrigin for synthesized symbols even if no docs exist
2021-05-07 10:20:40 -06:00
Victoria Mitchell
633ffece87 compare module names instead of pointers 2021-05-06 10:08:09 -06:00
Victoria Mitchell
4b5045f25a add "memberOf" relations for remote protocol implementations
rdar://75729692
2021-05-05 15:44:28 -06:00
Victoria Mitchell
d81d5d56d9 add sourceOrigin even if no docs exist
rdar://77205889
2021-05-04 10:47:13 -06:00
Alex Hoppen
e7d56037e8 Merge pull request #37133 from ahoppen/pr/serialize-text-module-symbolgraph
[SymbolGraph] Fix crasher when retrieving cursor info of method defined in ObjC
2021-04-30 23:13:15 +02:00
Alex Hoppen
5d3fb8f26d [SymbolGraph] Fix crasher when retrieving cursor info of method defined in ObjC
In a mixed Objective-C / Swift module, we have a Clang module overlay that’s a Source file, not a serialized AST as is currently assumed. That assumption caused a crash when retrieving the symbol graph as part of a cursor info request to SourceKit, which was invoked on a method defined in the Objective-C part of the module.

To fix the crash, recursively use the same logic that already exists to serialize a module to also serialize the clang overlay module since that function alreayd correctly handles the distinction between source files and serialized ASTs.

Resolves rdar://76951147
2021-04-29 17:54:18 +02:00
Alex Hoppen
370128e6b6 [SymbolGraph] Fix a crash for member in invalid extension
Don’t record a `memberOf` relationship if we couldn’t look up the target, e.g. because the member is declared in an extension whose extended type doesn’t exist.

Resolves rdar://74063899
2021-04-29 14:21:52 +02:00
QuietMisdreavus
170dcd88bc Merge pull request #36863 from apple/QuietMisdreavus/docs-inheritance
[SymbolGraph] Add information about "inherited docs" for synthesized symbols
2021-04-19 19:40:38 -06:00
QuietMisdreavus
640aa214c0 reword comment to reference inheriting, not just synthesis
Co-authored-by: Franklin Schrans <7278429+franklinsch@users.noreply.github.com>
2021-04-14 10:27:20 -05:00
Ben Barham
c54c9c7079 [Gardening] Extract basic source info structs from RawComment.h 2021-04-14 10:05:27 +10:00
Victoria Mitchell
8faaee8ab7 synthesized symbols should always inherit docs 2021-04-13 11:47:44 -05:00
Victoria Mitchell
977f134aef non-synthesized symbols can inherit docs too 2021-04-12 18:26:08 -05:00
Victoria Mitchell
f4154d6019 add flag to skip docs on synthesized symbols 2021-04-11 17:40:37 -05:00
Victoria Mitchell
983cbdf12f include information about synthesized symbols' sources
rdar://75741632
2021-04-11 17:40:32 -05:00
Victoria Mitchell
ba2b92be4e call it PrintMessages instead 2021-04-07 08:58:20 -06:00
Victoria Mitchell
0c5955b7fa silence symbolgraph-extract output without -v flag
rdar://72630103
2021-04-06 16:40:38 -06:00
Nathan Hawes
08250f058a [SourceKit/CursorInfo] Report the set of decls referenced in the symbol graph's "declarationFragments" field.
Resolves rdar://75809521
2021-04-03 09:42:54 +10:00
Victoria Mitchell
19e6144be4 always print enum elements
in some situations, enum element decls are being skipped when rendering
declaration fragments. this trips an assertion in the declaration
fragment renderer that ensures that it always renders something. by
always rendering enum elements, we can sidestep this issue.
2021-03-19 10:43:52 -06:00
QuietMisdreavus
84165788d8 Merge pull request #36422 from apple/QuietMisdreavus/enum-titles
[SymbolGraph] use fully qualified titles for enum elements
2021-03-15 10:04:14 -06:00
QuietMisdreavus
5871025259 Merge pull request #36367 from apple/QuietMisdreavus/symbol-availability
[SymbolGraph] don't filter out symbols if their availability was for a platform-agnostic target

rdar://74670284
2021-03-15 08:03:22 -06:00
Victoria Mitchell
5d1b588273 use fully qualified titles for enum elements
rdar://74051287
2021-03-12 13:45:11 -07:00
Victoria Mitchell
fe4984b9a7 don't filter symbols if they have platform-agnostic availability 2021-03-10 09:17:22 -07:00
Nathan Hawes
7886b5047d Merge pull request #36330 from nathawes/include-symbol-itself-in-parent-context-list
[SourceKit][CursorInfo] Also include the symbol itself in the "parent" contexts list
2021-03-10 12:53:52 +10:00
Nathan Hawes
b8832f4fbc [SourceKit][SymbolGraphGen] Also include the symbol itself in the "parent" contexts list.
Including the symbol itself means if clients want the same info we provide
about the parent contexts for the symbol under the cursor they won’t need to
parse it out from the symbol graph json.

Resolves rdar://problem/75121535
2021-03-06 12:04:37 +10:00
QuietMisdreavus
1451960933 [SymbolGraph] add a USR for RHS types in generic conformances (#36242)
rdar://70442228
2021-03-05 08:24:57 -07:00
Victoria Mitchell
db3685aa29 don't emit navigator name if it's the same as subHeading 2021-03-01 10:57:54 -07:00
AG
a5b804602d Merge pull request #35110 from bitjammer/acgarland/emit-symbol-graph
Add optional -emit-symbol-graph output when emitting modules
2021-02-12 09:00:58 -08:00
Nathan Hawes
6d940951ca [SourceKit][SymbolGraph] Add a 'ParentContexts' field the CursorInfo response
When the SymbolGraph json is requested via (key.retrieve_symbol_graph: 1) this adds
a new field in the response that lists all the parent contexts of the symbol under
the cursor with their symbol graph kind and name, and their USR:

key.parent_contexts: [
    {
      key.kind: "swift.struct",
      key.name: "Parent",
      key.usr: "s:27cursor_symbol_graph_parents6ParentV"
    },
    ...
  ]
}

Resolves rdar://problem/73904365
2021-02-10 16:35:57 +10:00
QuietMisdreavus
50032a6567 Merge pull request #35629 from apple/QuietMisdreavus/symbolgraph-typaram-usr
SymbolGraphGen: don't print USRs for type parameters
2021-01-28 14:46:03 -07:00
Victoria Mitchell
1e5dc37538 don't print USRs for type parameters into symbol graphs
rdar://73478316
2021-01-28 11:15:54 -07:00
Ashley Garland
69c4fc47cb Add optional -emit-symbol-graph output when emitting modules
rdar://71497047
2021-01-28 09:55:33 -08:00
Varun Gandhi
f9570b2d34 [NFC] Pass full convention printing boolean for types etc.
When -experimental-print-full-convention is set, we should be printing
the full convention in diagnostics, doc comments etc.
2021-01-25 18:47:39 -08:00
Nathan Hawes
968504db34 [SymbolGraphGen] Address review comments on new printSymbolGraphForDecl entrypoint.
Change it to use EXIT_SUCCESS/FAILURE rather than a bool to match
emitSymbolGraphForModule.
2020-12-12 14:38:41 +10:00
Nathan Hawes
388052b6ab [SymbolGraph][CursorInfo] Add option to SourceKit's CursorInfo request to include the SymbolGraph JSON
Adds a new 'key.retrieve_symbol_graph' option to the request. When set to 1 it
includes the JSON for a SymbolGraph containing a single node for the symbol at
the requested position.

This also extends the SymbolGraph library with a new entry point to get a graph
for a single symbol, and to additionally support type substitution to match the
existing CursorInfo behavior (e.g. so that when invoked on `first` in
`Array<Int>().first`, the type is given as `Int?` rather than `Element?`).

Resolves rdar://problem/70551509
2020-12-12 14:38:41 +10:00
Victoria Mitchell
bf9274d390 add the overlay module name to the overlay symbol graph file name 2020-12-11 12:08:25 -07:00
Victoria Mitchell
bfb2793e8a include cross-import overlay information in the symbol graph itself 2020-12-10 19:13:37 -07:00
Saleem Abdulrasool
7c968c6ccf AST: support availability on Windows
Enable Windows specific availability annotations in Swift.
2020-11-09 20:03:52 -08:00