Commit Graph

213 Commits

Author SHA1 Message Date
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
Ashley Garland
0e7a329ccd [SymbolGraph] Don't emit extension symbol graphs if empty
rdar://63058801
2020-06-04 15:40:07 -07:00
Ashley Garland
a72231128e [SymbolGraph] Don't print inherited list in declaration fragments
Add a new `PrintInherited` flag to `PrintOptions` to support this.

rdar://63033669
2020-06-04 11:52:51 -07:00
AG
7c8d860e03 Merge pull request #32093 from bitjammer/acgarland/rdar-63738390-inherit-availability
[SymbolGraph] Inherit availability from parent contexts
2020-06-04 10:34:28 -07:00
Ashley Garland
975d2520e8 [SymbolGraph] Print where clause in full declaration fragments
rdar://63233737
2020-06-02 11:33:42 -07:00
Ashley Garland
118e7c3cda [SymbolGraph] Inherit availability from parent contexts
Also be a little smarter about encountering duplicate `@available`
attributes on the same declaration.

rdar://63570830
2020-06-02 11:32:04 -07:00
Ashley Garland
51ce1f2b0f [SymbolGraph] Look for @_spi on extensions
Consider declarations inside `@_spi` extensions to be internal.

Clean up the "implicitly private" check to work for `Decl` and not just
`ValueDecl`, allowing it to be used directly on extensions instead of having to
look for extensions everywhere.

rdar://63361634
2020-05-27 16:00:15 -07:00
AG
ef7da4d47a Merge pull request #31903 from bitjammer/acgarland/rdar-63233897-get-set-proto-req
[SymbolGraph] Show get/set on property/subscript full declarations
2020-05-26 11:04:48 -07:00
Owen Voorhees
45bc578ae5 [SourceManager] Rename line and column APIs for clarity 2020-05-21 12:54:07 -05:00
Ashley Garland
720d3d2f2a [SymbolGraph] Show get/set on property/subscript full declarations
But don't show them in subheading contexts.

rdar://63233897
2020-05-20 14:16:45 -07:00
Anthony Latsis
55447e66aa Merge pull request #31645 from AnthonyLatsis/relocate-to-iterabledc
[NFC] AST: Relocate some conformance lookup client methods from DeclContext to IterableDeclContext
2020-05-18 22:25:08 +03:00
Anthony Latsis
edcf7640c0 [NFC] AST: Define and use IterableDeclContext::getAsGenericContext() 2020-05-08 03:15:07 +03:00
Saleem Abdulrasool
09975d1253 sprinkle llvm_unreachable for covered switches (NFC)
Annotate the covered switches with `llvm_unreachable` to avoid the MSVC
warning which does not recognise the covered switches.  This allows us
to avoid a spew of warnings.
2020-05-07 11:05:35 -07:00
Ashley Garland
f2c10d2ed4 [SymbolGraph] Use identifier for type name fragments
In the cases where we specialize the presentation of type declarations in a
subheading or navigator setting, make sure to use the `identifier` fragment
kind instead of `typeIdentifier` to keep it consistent with the normal or
"full" setting.

rdar://62953144
2020-05-06 17:28:28 -07:00
Varun Gandhi
65577940d0 [NFC] Get rid of -Wrange-loop-analysis warnings. (#31324) 2020-04-27 09:47:52 -07:00
Ashley Garland
d4e5c6f438 [SymbolGraph] Add navigator declaration fragments
Only print the type name for a type's navigator fragments.

Don't print where clauses for navigator or subHeading fragments.

rdar://62353465
2020-04-24 20:20:19 -07:00
Ashley Garland
d5aa0d0543 [SymbolGraph] Pick best synthesized member when possible
A type can have multiple overloads available from different protocols from
which it inherits. Ask the type checker to pick the best one where possible.

rdar://60193198
2020-04-24 18:24:54 -07:00
Anthony Latsis
74252028ca AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl 2020-04-23 05:16:55 +03:00
Ashley Garland
9d6ec078c2 [SymbolGraph] Filter @_spi declarations
These definitely shouldn't be showing up in symbol graphs with a minimum access
level of `public`, and it's not clear whether another minimum access level
should show these. For now, filter them unconditionally.

rdar://62081711
2020-04-21 14:01:58 -07:00
Ashley Garland
115a8de9ae [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
2020-04-20 14:25:19 -07:00
Ashley Garland
7d7a8d35e5 [SymbolGraph] Don't trim comment segments past the first nonspace offset
Otherwise, the `SourceManager` may skip over a blank line, causing
it to have a line number off by one.

Measure initial indentation from the first non-blank line.

rdar://61827368
2020-04-16 14:24:23 -07:00
AG
ed28d8bd95 Merge pull request #31045 from bitjammer/acgarland/sgf-0.5.0
[SymbolGraph] Bump format version to 0.5.0 NFC
2020-04-15 17:01:01 -07:00
AG
21e9307dd9 Merge pull request #31047 from bitjammer/acgarland/rdar-61746582-dont-use-innermost-context
[SymbolGraph] Don't use innermost context for swiftExtension
2020-04-15 15:43:27 -07:00
AG
240a86f5e0 Merge pull request #31044 from bitjammer/acgarland/rdar-61843516-ext-use-isimplicitlyprivate
[SymbolGraph] Use isImplicitlyPrivate for extended types
2020-04-15 15:03:19 -07:00
AG
4e56349399 Merge pull request #31032 from bitjammer/acgarland/rdar-61459287-no-members-for-defaultimplementations-of-requirements
[SymbolGraph] Don't emit memberOf for default implementations or requ…
2020-04-15 14:03:18 -07:00
Ashley Garland
d62e4ac4d7 [SymbolGraph] Don't use innermost context for swiftExtension
`getInnerMostContext` can return the same value if it is a type, but
`swiftExtension` should always look upward for an extension.

rdar://61746582
2020-04-15 13:59:54 -07:00
Ashley Garland
bad8904c9d [SymbolGraph] Bump format version to 0.5.0 NFC 2020-04-15 13:12:10 -07:00
Ashley Garland
98d8eb9074 [SymbolGraph] Use isImplicitlyPrivate for extended types
This was just using `hasUnderscoredNaming` before but this only checks the
leafmost type. When filtering extended types, it should continue to look up
through nesting types to see if they are also implicitly private.

rdar://61843516
2020-04-15 13:01:15 -07:00
Ashley Garland
8316157c5e [SymbolGraph] Don't emit memberOf for default implementations or requirements
To differentiate between freestanding extensions of protocols and matching
default implementations with their requirements. Otherwise, it's difficult to
filter out "duplicate" entries for protocols.

rdar://61459287
2020-04-14 20:13:00 -07:00
Ashley Garland
9611047d4a [SymbolGraph] Add internal/externalParam declaration fragment
These were previously mapped to identifier. Some clients may wish to render
these differently in their declaration blocks.

rdar://61782916
2020-04-14 16:06:56 -07:00
AG
f9610de25b Merge pull request #31000 from bitjammer/acgarland/rdar-61178480-indirect-default-impls
[SymbolGraph] Look at inherited protocols for default implementations
2020-04-14 09:18:15 -07:00
Ashley Garland
72dbdb097d [SymbolGraph] Look at inherited protocols for default implementations
rdar://61178480
2020-04-13 15:47:46 -07:00
Ashley Garland
06d1d502a1 [SymbolGraph] Ignore some Self requirements
To ease the burden on the client, ignore some generic requirements involving
Self. For example, `Self: P` where we already know that `Self` conforms to `P`.

An example case:

```
public struct S: Equatable {
  public static func ==(lhs: S, rhs: S) -> Bool { ... }
}
```

`!=` is defined in terms of `Self` and the default implementation has a `Self:
Equatable`. For the purposes of documentation, it's not necessary to specify
that again on the page of documentation for `!=`.

rdar://60963924
2020-04-13 13:17:33 -07:00
AG
4e85c51b07 Merge pull request #30857 from bitjammer/acgarland/rdar-60796811-rootmost-extension-sgf
[SymbolGraph] Put extending declarations in rootmost module
2020-04-08 09:41:25 -07:00
Dan Zheng
c834696bfa Add SynthesizedFileUnit.
`SynthesizedFileUnit` is a container for synthesized declarations. Currently, it
only supports module-level declarations.

It is used by the SIL differentiation transform, which generates implicit struct
and enum declarations.
2020-04-07 18:29:26 -07:00
Ashley Garland
d6e49a98db [SymbolGraph] Put extending declarations in rootmost module
When extending another module's type in your module, serialize declarations in
the extension into the other module's "extension" symbol graph file, including
relationships. This mechanic should continue up to the rootmost module. For
example:

A.AStruct <- B.BStruct < C.CStruct

Both BStruct and CStruct should go in `@A` symbol graph files because AStruct
owns BStruct and by extension owns CStruct. This is reflected in
documentation curation in some form already.

rdar://60796811
2020-04-07 15:41:59 -07:00
Ashley Garland
58edd83f37 [SymbolGraph] Completely filter unavailable/obsoleted symbols
Symbol graph files are processed per platform--documentation for symbols that
are unconditionally unavailable or obsoleted on a platform shouldn't be shown
for that same platform.

Also, removes `isUnconditionallyUnavailable` from the JSON format. If it's
unconditionally unavailable, it won't show up at all.

rdar://60193675
2020-03-18 09:43:08 -07:00
Ashley Garland
ac6132a2c0 [SymbolGraph] Bump format version to 0.4.0 NFC
rdar://60541965
2020-03-17 09:49:21 -07:00
Ashley Garland
eaad8a7241 [SymbolGraph] Serialize Location uri and position together
or not at all. This information comes as one unit from .swiftsourceinfo so the
code should reflect that.

rdar://60499122
2020-03-16 10:10:10 -07:00
Ashley Garland
5b6becf186 [SymbolGraph] Omit empty docComment fields
rdar://59500543
2020-03-10 19:37:39 -07:00