Commit Graph

10 Commits

Author SHA1 Message Date
Ashley Garland
69c4fc47cb Add optional -emit-symbol-graph output when emitting modules
rdar://71497047
2021-01-28 09:55:33 -08:00
Alexis Laferrière
56c77df926 [Serialization] Skip SPI documentation in swiftdoc files
Hide comments from SPI decls in all swiftdoc files. This applies the
same restrictions as private declarations. This is a temporary solution,
a long term fix is to emit both a public and an internal swiftdoc file.

rdar://63729195
2020-05-28 12:58:59 -07:00
Nathan Hawes
b9d5672ca1 [SourceKit] Add a global-configuration request to control SourceKit's behavior around .swiftsourceinfo files
SwiftSourceInfo files provide source location information for decls coming from
loaded modules. For most IDE use cases it either has an undesirable impact on
performance with no benefit (code completion), results in stale locations being
used instead of more up-to-date indexer locations (cursor info), or has no
observable effect (live diagnostics, which are filtered to just those with a
location in the primary file).

For non-IDE clients of SourceKit though, cursor info providing declaration
locations for symbols from other modules is useful, so add a global
configuration option (and a new request to set it) to control whether
.swiftsourceinfo files are loaded or not based on use case (they are loaded by
default).
2019-12-03 13:15:20 -08:00
Xi Ge
ba6891d7c8 SerializeLoc: include source locations for double underscored symbols in .swiftsourceinfo file
For .swiftdoc file, we don't expose doc-comments for underscored symbols. But this
seems to be an unnecessary constraint on .swiftsourceinfo file since we put
these symbols in .swiftinterface files anyway.
2019-10-09 15:29:52 -07:00
Xi Ge
6fd332d62c Doc-serialization: skip declarations with double-underscore as name prefix
Double-underscored names suggest the symbols aren't supposed to be used by framework
clients. This patch excludes the doc-comments of these symbols in swiftdoc files.

rdar://51468650
2019-06-10 14:00:41 -07:00
Jordan Rose
2dfa303975 [Serialization] Preserve source order in serialization (#18361)
We previously shied away from this in order to not /accidentally/
depend on it, but it becomes interesting again with textual
interfaces, which can certainly be read by humans. The cross-file
order is the order of input files, which is at least controllable by
users.
2018-07-31 13:15:07 -07:00
Dmitri Gribenko
984210aa53 tests: replace '// RUN: rm -rf' '// RUN: mkdir' pairs with '%empty-directory(...)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Drew Crawford
aa5cf2b842 [Serialization] Don't serialize non-public documentation
Let's say I am a good citizen and document my private symbols:

    /** My TOP SECRET DOCUMENTATION */
    private class Foo {
    }

When I go to distribute the compiled binary, I find out my private
documentation is distributed as well:

    $ swiftc test.swift -emit-module -module-name "test"
    $ strings test.swiftdoc
    My TOP SECRET DOCUMENTATION
    /** My TOP SECRET DOCUMENTATION */

If a client can't use a symbol (e.g. it's private [or internal and not
-enable-testing]) don't emit the documentation for a symbol in the
swiftdoc.

Fixes: SR-762, rdar://21453624

The test coverage implements this truth table:

| visibility | -enable-testing | documentation? |
|------------|-----------------|----------------|
| private    | no              |              |
| internal   | no              |              |
| public     | no              |              |
| private    | yes             |              |
| internal   | yes             |              |
| public     | yes             |              |

Modified the existing comments test coverage to expect non-public
documentation not to be emitted.

Don't rely on existing comment structure

Refuse to emit comments if the decl cannot actually have one.  To
accomplish this, we move `canHaveComment` into the Decl instance.  It
must also be marked `const`, since one of its existing usages operates
on a const pointer.

Perform fewer checks when serializing the standard library.
2016-03-17 17:46:23 -05:00