Commit Graph

213 Commits

Author SHA1 Message Date
Doug Gregor
5ab6b72604 [Macros] Turn Macro into a declaration node.
Although the declaration of macros doesn't appear in Swift source code
that uses macros, they still operate as declarations within the
language. Rework `Macro` as `MacroDecl`, a generic value declaration,
which appropriate models its place in the language.

The vast majority of this change is in extending all of the various
switches on declaration kinds to account for macros.
2022-11-13 12:21:29 -08:00
Ben Barham
1526cfacd6 Merge pull request #61838 from bnbarham/symbol-graph-should-print-custom-attrs
[SymbolGraph] Output custom attributes
2022-11-01 11:35:45 -07:00
Ben Barham
1aee0af1d4 [SymbolGraph] Output custom attributes
Custom attributes were being skipped as their attribute name started
with a "_". Underscored attributes are typically unstable and thus
shouldn't be printed, but "_" is not being used for that purpose in the
case of "_custom".

Rather than checking for "_" or "__", just use `UserInaccessible`. This
property is used for attributes that shouldn't be shown to users in eg.
completion/printing/etc.

Resolves rdar://99029554.
2022-10-31 15:16:59 -07:00
Allan Shortlidge
af032afb9d Serialization: Break the cycle between Serialization and SymbolGraphGen.
Push the top level logic for writing out swiftmodules and associated files into the frontend library which has access to all the necessary dependencies.
2022-10-29 21:37:09 -07:00
Holly Borla
38a2c8218b [Requirement] Rename RequirementKind::SameCount to SameShape. 2022-10-06 20:48:40 -07:00
QuietMisdreavus
4413cee7bf don't use null types when determining extension access level (#61227)
rdar://100169094

Co-authored-by: Max Obermeier <themomax@icloud.com>
2022-09-21 14:19:04 -06:00
Max Obermeier
453fd2231b Allow for emission of swift.extension symbols for extensions to external types in swiftSymbolGraphGen (#59047)
This includes:
 - bumping the SWIFT_SYMBOLGRAPH_FORMAT_MINOR version
 - introduction of the "swift.extension" symbol and "extensionTo" relationship
 - adding support for ExtensionDecl to the Symbol class
 - adding a "typeKind" field to the symbol's extension mixin which indicates what kind
   of symbol was extended
 - intoduction of the -emit-extension-block-symbols flag, which enables the behavior
   outlined below
 - adaptions to SymbolGraphASTWalker that ensure a swift.extension symbol is emitted
   for each extension to a type that does not exist in the local symbol graph
 - adaptions to SymbolGraph and SymbolGraphASTWalker that ensure member and conformance
   relationships are correctly associated with the swift.extension symbol instead of
   the original type declaration's (extended nominal's) symbol where applicable
 - adaptions to SymbolGraphASTWalker that ensure swift.extension symbols are connected
   to their respective extended nominal's symbol using an extensionTo relationship

Testing:
- adds SymbolGraph tests that test behavior only relevant in
  -emit-extension-block-symbols mode
- adapts some SymbolGraph tests to additionally test similar behavior for
  extensions to external types in -emit-extension-block-symbols mode
- adapts some SymbolGraph tests to (additionally or exclusively) test the
  behavior with -emit-extension-block-symbols mode enabled

Bugfixes:
- fixes a bug where some conformsTo relationships implicated by the conformances
  declared on an extension to an external type were not emitted
  (see test/SymbolGraph/Relationships/ConformsTo/Indirect.swift)

Further changes:
- documents the strategy for naming and associating children declared in extensions
  to typealiases (see test/SymbolGraph/Relationships/MemberOf/Typealias.swift,
  test/SymbolGraph/Symbols/Names.swift)
2022-09-16 12:02:40 -06:00
QuietMisdreavus
d043378412 [SymbolGraphGen] Refactor export-import logic (#61049)
rdar://98808363
2022-09-13 10:08:10 -06:00
QuietMisdreavus
f674b473ec introduce a @_documentation(...) attribute to influence SymbolGraphGen (#60242)
* add @_documentation(...) attribute to influence SymbolGraphGen

rdar://79049241
2022-09-06 14:12:42 -06:00
Victoria Mitchell
8073a2a586 give inherited/synthesized objc symbols a synthesized base type
rdar://98670682
2022-09-01 11:26:46 -06:00
Slava Pestov
5c32f2136e AST: Introduce RequirementKind::SameCount 2022-08-23 11:12:00 -04:00
Slava Pestov
eb77da1ca3 SymbolGraph: Stop calling getAllConformances() on protocols 2022-08-23 00:03:37 -04:00
swift-ci
ff3985fbe3 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-22 18:14:54 -07:00
swift-ci
cf85fc5b6c Merge pull request #58568 from jsoref/spelling-lib-symbolgraphgen
Spelling lib symbolgraphgen
2022-07-22 18:00:56 -07:00
swift-ci
a0c70488e9 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-20 08:54:21 -07:00
QuietMisdreavus
a83a17c88b Revert "consider requirements of an underscored protocol to also be underscored (take two) (#59531)" (#60096)
This reverts commit ababa79398.
2022-07-20 09:54:03 -06:00
swift-ci
bb56ee29d0 Merge remote-tracking branch 'origin/main' into rebranch 2022-07-08 08:14:09 -07:00
QuietMisdreavus
2d874788f6 [SymbolGraphGen] only include the given symbol for qualified imports (#59852)
* only include the given symbol for qualified imports

rdar://96309088

* re-exporting one type should not allow unrelated types to sneak in

* ensure that children of re-exported types are also re-exported
2022-07-08 09:13:08 -06:00
swift-ci
3936df3b85 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-23 12:34:34 -07:00
QuietMisdreavus
ababa79398 consider requirements of an underscored protocol to also be underscored (take two) (#59531)
* Revert "Revert "consider requirements of an underscored protocol to also be underscored""

* make SkipsPublicUnderscore more resilient to non-determinism
2022-06-23 13:26:21 -06:00
swift-ci
294ae6edbe Merge remote-tracking branch 'origin/main' into rebranch 2022-06-16 19:54:26 -07:00
QuietMisdreavus
5e065f0c31 Revert "consider requirements of an underscored protocol to also be underscored (#59480)"
This reverts commit a8ecfc94ec.
2022-06-16 20:33:34 -06:00
swift-ci
3a37d71b71 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-16 13:34:31 -07:00
QuietMisdreavus
a8ecfc94ec consider requirements of an underscored protocol to also be underscored (#59480)
rdar://94336558
2022-06-16 14:20:14 -06:00
swift-ci
b6b2919f08 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-13 16:33:39 -07:00
swift-ci
9eded1516d Merge pull request #59129 from apple/QuietMisdreavus/exported-ext
re-exported synthesized extensions need to go under the base module
2022-06-13 16:33:34 -07:00
swift-ci
d48600da5b Merge remote-tracking branch 'origin/main' into rebranch 2022-06-03 08:16:16 -07:00
Jager-yoo
3b8db192a0 [Gardening] fix typo "supercede" -> "supersede" 2022-05-29 03:35:24 +09:00
Victoria Mitchell
3bec6223cb re-exported synthesized extensions need to go under the base module
rdar://93928003
2022-05-27 13:10:24 -06:00
swift-ci
284a50fa81 Merge remote-tracking branch 'origin/main' into rebranch 2022-05-24 10:54:14 -07:00
QuietMisdreavus
5bef9f2118 [SymbolGraphGen] Add filename and module name to symbols' doc comments (#58857)
* move symbol graph samples to the bottom of the file

* add information about a doc comment's file and module

rdar://81190369

* refactor: group file URI collection/serialization together

* test for docComment.module to identify externally-inherited docs
2022-05-24 11:36:13 -06:00
Ben Barham
ac4715bb33 [rebranch] Remove check for minor version
Minor isn't provided in the `Triple` for Linux, so it's no longer added
to the output.
2022-05-23 11:37:45 -07:00
Ben Barham
4e1eb1abe8 Merge pull request #58620 from bnbarham/rebranch-fixes
[rebranch] Various fixes to get macos to a compiling state
2022-05-06 09:59:38 -07:00
Ben Barham
114b4d96e4 [next] Use new VersionTuple API
The `VersionTuple` API was changed llvm/llvm-project
219672b8dd06c4765185fa3161c98437d49b4a1b to return `VersionTuple`
from `get*Version` rather than pass in major, minor, and subminor output
parameters. Update uses to the new API.

Note that `getMacOSXVersion` is slightly different in that it returns a
boolean while taking a `VersionTuple` output parameter to match its
previous behaviour. There doesn't seem to be any use that actually
checks this value though, so we should either update the API to return
an `Optional` and actually check it *or* remove the "failure" case and
return a `VersionTuple` like all the others.
2022-05-05 16:25:10 -07:00
QuietMisdreavus
c885dc6fd6 [SymbolGraphGen] consider modules not equal if they're not from the same compiler (#58421)
* consider modules not equal if they're not from the same compiler

rdar://92263972

* add swift-symbolgraph-extract command and checks to the test
2022-05-05 14:47:35 -06:00
Josh Soref
dbaa13212c spelling: retrieve
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-30 23:36:19 -04:00
Josh Soref
40f2db337a spelling: indentation
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-30 23:36:19 -04:00
Josh Soref
90afda6dee spelling: extension
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-30 23:36:19 -04:00
Josh Soref
7a29358efc spelling: condition
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-30 23:36:19 -04:00
QuietMisdreavus
1b5c3d79dd skip underscored implicit Clang decls (#42493)
rdar://92018648
2022-04-22 16:43:31 -06:00
Ben Barham
680bf2e753 [CursorInfo] Add ObjC location to generated symbol graph
Add the file for an imported ObjC-symbol to the generated symbol graph
when ObjC documentation is requested.

Skips line/column information for now since it's not needed. If we add
those we should extract location retrieval to a common method for both
cursor info and symbol graph gen.

Resolves rdar://91658873.
2022-04-13 14:51:43 -07:00
Ben Barham
e2c9836a1d [CursorInfo] Add Clang documentation to SymbolGraph output
This currently doesn't check for inherited docs, ie. either the
imported declaration has docs or it doesn't. There's also a few odd
cases with mixed doc types and when each line is prefixed with '*', but
it's good enough for an initial implementation.

Moves UTF8 sanitisation out of ASTPrinter.h and into Unicode.h so that
it can be used here as well.

Resolves rdar://91388603.
2022-04-08 13:46:38 -07:00
QuietMisdreavus
e24f126165 [SymbolGraph] don't emit symbols for implicit inherited initializers (#41985)
rdar://90401347
2022-04-01 10:02:19 -06:00
Evan Wilde
aa51bdf17a Add noasync availability kind to available attr
This patch adds the `noasync` availability kind to `@available`. The
spelling is `@available(*, noasync)`.
2022-03-22 15:12:51 -07:00
Franklin Schrans
9cd44ca5d1 [SymbolGraphGen] Emit symbols from exported modules
When emitting a symbol graph file for a module that import modules via
`@_exported import`, emits those modules' symbols as well.

SR-15753

rdar://89547374
2022-02-28 17:21:25 +00:00
Victoria Mitchell
cab1669e09 only recurse getDisplayDecls in SymbolGraphGen 2022-02-19 10:32:29 -07:00
Franklin Schrans
7c5a8fd0a1 [SymbolGraph] Don't emit symbols that are unavailable on all platforms
rdar://88807294
2022-02-16 10:10:02 +00:00
QuietMisdreavus
f0c96b1c97 Merge pull request #41141 from apple/QuietMisdreavus/symgraph-synth-init
[SymbolGraph] don't filter out all implicit decls
2022-02-03 16:25:05 -07:00
Victoria Mitchell
08fe7c2134 [SymbolGraph] don't filter out all implicit decls 2022-02-02 12:57:40 -07:00
Victoria Mitchell
9bd3454566 [SymbolGraph] consider underscored symbols as private if they're internal
rdar://86294802
2022-02-02 09:56:50 -07:00