Commit Graph

102 Commits

Author SHA1 Message Date
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
3405691582
b59910ef5b Add OpenBSD to PlatformKinds.def.
In #31686 changes were introduced to ensure that capacity was stored in
the ManagedBuffer allocation, and @lorentey sugested that as a stopgap
measure for addressing the lack of platform malloc introspection on
OpenBSD, we use Swift availability attributes instead on the relevant
parts of ManagedBuffer and friends.

Since platform availability symbols must be specifically set up to be
used, this commit does so in advance of the above change.
2020-09-09 18:57:26 -04:00
David Zarzycki
1e940c2c7e [NFC] Fix -Wsuggest-override warnings
LLVM, as of 77e0e9e17daf0865620abcd41f692ab0642367c4, now builds with
-Wsuggest-override. Let's clean up the swift sources rather than disable
the warning locally.
2020-08-13 16:17:46 -04:00
Ashley Garland
ecf8d556e5 [SymbolGraph] Don't link type identifier fragments to private symbols
These links will never resolve because the symbols are never emitted
in the first place.

rdar://64178490
2020-08-07 14:20:28 -07:00
Nathan Hawes
244dc4a768 [AST] Rename PlatformKind::OSX to PlatformKind::macOS
Because the names are coming from a .def file used for printing too, this
simplifies the printing logic as well.
2020-07-08 16:29:31 -07:00
Ashley Garland
0a29ba8839 [SymbolGraph] Add back isUnconditionallyUnavailable
It turns out this needed to prevent automatically inheriting a
default introduced availability for a given module.

rdar://64536460
2020-06-19 11:16:54 -07:00
Ashley Garland
a9d692c1fb [SymbolGraph] Only include where clause constraints in swiftExtension
Otherwise, this creates noise in conditional conformance phrasings.

rdar://64425199
2020-06-17 09:51:59 -07:00
AG
29d3cc40cf Merge pull request #32246 from bitjammer/acgarland/rdar-63941806-dont-link-self-fragment
[SymbolGraph] Don't add precise identifier to `Self` fragment
2020-06-08 15:37:38 -07:00
Ashley Garland
580bf4d2c9 [SymbolGraph] Don't add precise identifier to Self fragment
So that these identifiers aren't turned into links.

rdar://63941806
2020-06-08 12:51:59 -07:00
Ashley Garland
f822296cb2 [SymbolGraph] Use fully qualified name for type's page titles
rdar://64047985
2020-06-08 10:36:06 -07:00
Ashley Garland
dd7a7f7c89 [SymbolGraph] Print non-underscored attributes in declarations
rdar://63338507
2020-06-05 13:36:22 -07:00
AG
fb99cfcf6b Merge pull request #32189 from bitjammer/acgarland/rdar-63033669-sgf-full-decl-no-inherited
[SymbolGraph] Don't print inherited list in declaration fragments
2020-06-05 12:55:42 -07:00