Commit Graph

27 Commits

Author SHA1 Message Date
Ben Barham
eec2848508 [SourceKit] Stop using isSystemModule to represent "non-user" modules
Rather than using `ModuleDecl::isSystemModule()` to determine whether a
module is not a user module, instead check whether the module was
defined adjacent to the compiler or if it's part of the SDK.

If no SDK path was given, then `isSystemModule` is still used as a
fallback.

Resolves rdar://89253201.
2023-03-15 14:29:48 -07:00
Ben Barham
46d12f8b51 [InterfaceGen] Print @discardableResult in generated interfaces
Resolves rdar://58805969.
2022-11-11 18:15:35 -08:00
Rintaro Ishizaki
8bda524cd2 [SourceKit] Update for primary associated types
* InterfaceGen reports a primary associated type as a reference to the
  'associatedtype' declaration
* CursorInfo on a primary associated type returns information of the
  'associatedtype' declaration

rdar://93275458
2022-05-18 17:16:49 -07:00
Hamish Knight
c19359af57 [test] Add additional test case for rdar://76685011
Make sure we don't print the @completionHandlerAsync
attr in the doc info.
2021-05-20 16:35:43 +01:00
Hamish Knight
f439275380 Mark imported @completionHandlerAsync attrs as implicit
Mark imported `@completionHandlerAsync` attrs as
implicit, which avoids printing them in generated
interfaces. And for the sake of completion,
serialize the implicit bit in case it's used
elsewhere in the future.

To make sure we continue to print
`@completionHandlerAsync` attributes explicitly
written by the user in Swift, add a SourceKit
interface test.

Resolves rdar://76685011
2021-04-30 11:14:50 +01:00
Argyrios Kyrtzidis
4f4c90b9fe Merge pull request #32046 from nathawes/interface-gen-exposed-underscore
[SourceKit][InterfaceGen] Don't print clang decls marked with the swift_private attribute.
2020-05-28 14:01:02 -07:00
Nathan Hawes
79247b22e2 [SourceKit][InterfaceGen] Don't print clang decls marked with the swift_private attribute.
This attribute is intended to mean there's a replacement declaration that
should be used instead in Swift code. We already filter out decls with this
attribute in code completion, but were still exposing them in generated
interfaces.

Resolves rdar://problem/62464954
2020-05-27 15:23:50 -07:00
Nathan Hawes
5cb1f30994 [IDE][InterfaceGen] Always print the top-level decl in header file generated interface.
While the decls being printed for header file generated interfaces were mapped
from the top-level clang decls in that file, the Swift decls they correspond to
may not be top-level. E.g. top-level functions in the header file can be mapped
to property accessors on the Swift side, which were being printed simply as
"get" at the top level.

This updates header interface generation to map each decl to its top-level decl
before printing.

Resolves rdar://problem/63409659
2020-05-21 21:12:17 -07:00
Robert Widmann
672cc845e0 Delete an old test 2019-08-26 20:54:53 -07:00
Xi Ge
cc395e792c SourceKit/InterfaceGen: sanitize Clang-specific doc-comment style when printing headers as Swift interface
rdar://47985888
2019-03-11 14:16:45 -07:00
Xi Ge
b4c224966b Re-apply "sourcekitd/test: add an interface grouping test for user module." 2019-02-15 11:20:01 -08:00
Ben Langmuir
f1803c87a9 Revert "sourcekitd/test: add an interface grouping test for user module." 2019-02-15 08:26:41 -08:00
Xi Ge
69cf097db8 sourcekitd/test: add an interface grouping test for user module. 2019-02-14 13:44:17 -08:00
Slava Pestov
6903e716fd Sema: Diagnose unsupported existential types in more places
Fixes <rdar://problem/23427259>, <https://bugs.swift.org/browse/SR-4207>.
2018-11-16 01:18:18 -05:00
Xi Ge
87ed4b4488 [test] Remove Swift 3 flags from various tests. 2018-10-09 16:09:41 -07:00
Rintaro Ishizaki
b3453c17fe [ClangImporter] Take isCompatibilityAlias() into account in interface printing (#16625)
If the Clang declrations are *types*, canonical declaration in Swift is
imported for newest version of Swift. In interface generation, if the
declaration is versioned and it's imported as a member in either or both
version of Swift, we have to take compatibility typealias into account.

* Fixed 'ClangModuleUnit::getTopLevelDecls' to take isCompatibilityAlias() into account
* Fixed bugs in ClangImporter where member-to-member versioned types aren't properly imported.
  * Fixed 'SwiftDeclConverter::importFullName' to check equality of getEffectiveContext()
  * Fixed 'importer::addEntryToLookupTable' to check equality of getEffectiveContext()
    (moved 'ClangImporter::Implementation::forEachDistinctName' to 'NameImporter')
2018-05-22 13:38:45 +09:00
Argyrios Kyrtzidis
896c4645df [SourceKit] Accept swift_version in requests and use to set the swift version for interface generation of an ObjC header
rdar://31432960
2017-05-04 16:53:00 -07:00
Doug Gregor
823c24b355 [SE-0112] Rename ErrorProtocol to Error.
This is bullet (5) of the proposed solution in SE-0112, and the last
major piece to be implemented.
2016-07-12 10:53:52 -07:00
Jordan Rose
aee92ff612 SE-0025: Parsing and basic completion for 'fileprivate'. (#3391)
Right now 'fileprivate' is parsed as an alias for 'private' (or
perhaps vice versa, since the semantics of 'private' haven't changed
yet). This allows us to migrate code to 'fileprivate' without waiting
for the full implementation.
2016-07-07 15:20:41 -07:00
practicalswift
ea0ac3ac67 [gardening] Remove all tabs in C++ code 2016-04-08 21:22:57 +02:00
Dmitri Gribenko
a257715fcc Revert "[stdlib] [SE-0031] update stdlib for SE-0031 (inout adjustment)" 2016-02-26 11:17:10 -08:00
Daniel Duan
13b5c8f3bc [SE-0031] update code base for SE-0031 (inout adjustment) 2016-02-26 10:52:10 -08:00
Xi Ge
dfd0a86986 [SourceKit] Teach SourceKit to recognized USRs for synthesized extensions.
So that IDE can jump to the synthesized extensions instead of the actual extensions.
2016-02-16 17:22:58 -08:00
Xi Ge
218c9607b2 [test] Add a test for previously crashing interface gen. rdar://23544224 2015-12-08 15:39:05 -08:00
Xi Ge
bef5b4301d [SourceKit][PrintObjcHeader] Avoid printing the same Swift decl twice.
Clang and Swift decls likely have many-to-one mappings; for instance,
a RecordDecl and a TypedefDecl in Clang are both imported as the same Swift
NominalTypeDecl. This commit reduces duplication when we print Clang decls in
Swift. rdar://23275959
2015-12-07 16:24:23 -08:00
Jordan Rose
6e1bf0d10d Rename @exported to @_exported for now.
At some point I want to propose a revised model for exports, but for now
just mark that support for '@exported' is still experimental and subject
to change. (Thanks, Max.)
2015-11-05 11:59:00 -08:00
Argyrios Kyrtzidis
8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00