Commit Graph

15 Commits

Author SHA1 Message Date
Rintaro Ishizaki
7b3738d1d0 [SourceKit] Adjust newlines between decls
Previously, Clang modules didn't have empty lines between top-level
decls. This was inconsistent with Swift module.
2024-03-25 22:07:50 +09:00
Rintaro Ishizaki
c9785d955d [SourceKit] Stop printing normal comments in clang generated interface
Generated interfaces for Clang modules used to try printing normal
comments between decls extracted from the header text. That was because
doc-comment was not common in C/ObjC headers. But mainly because of
"import as member feature" Clang decls aren't printed in the order as
they appear in the header file, the logic determinig which comment
belongs to which decl was not working property. We've decided to remove
that feature and only print the proper doc-comments as it has been
getting common.

rdar://93731287
2024-03-21 11:52:32 +09:00
Hamish Knight
1ffa8eeea4 [ClangImporter] Query Preprocessor::macros instead of getPreprocessingRecord for header printing
This better matches what the clang importer does
normally, avoids a Clang issue where
`getPreprocessedEntitiesInRange` returns incorrect
results, and avoids the need to enable the
preprocessor record. This then lets us re-enable
`print_clang_headers.swift`.

rdar://102151774
2023-05-11 21:10:28 +01:00
Nathan Hawes
9bcb54910e [AST] Prefer the 'macOS' spelling over 'OSX' when printing the platform kind.
This affects module interfaces, interface generation in sourcekitd, and
diagnostics. Also fixes a fixit that was assuming the 'OSX' spelling when
computing the source range to replace.

Resolves rdar://problem/64667960
2020-07-08 13:51:25 -07:00
Ben Langmuir
fc556317b6 Reapply "Normalize version tuples in availability attributes coming from clang to use ".""
This reapplies f1c48daf70 with the test split up so that the
availability bits don't affect other platforms.

Seen as @available attributes being printed with "_" in interface
generation, but fixing it in the importer means they can't leak into
anywhere else.

rdar://problem/30451293
2018-01-03 13:09:21 -08:00
Ben Langmuir
b083020759 Revert "Normalize version tuples in availability attributes coming from clang to use "."" 2017-09-05 14:03:31 -07:00
Ben Langmuir
f1c48daf70 Normalize version tuples in availability attributes coming from clang to use "."
Seen as @available attributes being printed with "_" in interface
generation, but fixing it in the importer means they can't leak into
anywhere else.

rdar://problem/30451293
2017-09-01 16:24:21 -07:00
Jordan Rose
01cb554387 Re-apply "Make all CF types Equatable and Hashable." (#4568)
Like NSObject, CFType has primitive operations CFEqual and CFHash,
so Swift should allow those types to show up in Hashable positions
(like dictionaries). The most general way to do this was to
introduce a new protocol, _CFObject, and then have the importer
automatically make all CF types conform to it.

This did require one additional change: the == implementation that
calls through to CFEqual is in a new CoreFoundation overlay, but the
conformance is in the underlying Clang module. Therefore, operator
lookup for conformances has been changed to look in the overlay for
an imported declaration (if there is one).

This re-applies 361ab62454, reverted in
f50b1e73dc, after a /very/ long interval
where we decided if it was worth breaking people who've added these
conformances on their own. Since the workaround isn't too difficult---
use `#if swift(>=3.2)` to guard the extension introducing the
conformance---it was deemed acceptable.

https://bugs.swift.org/browse/SR-2388
2017-05-08 14:05:11 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Argyrios Kyrtzidis
2ec7a31b6f [IDE] When doing ObjC header interface printing, ignore forward references to protocols as well.
Swift SVN r30945
2015-08-03 15:25:19 +00:00
Argyrios Kyrtzidis
881a98bca9 [IDE] When doing ObjC header interface printing, ignore decls in that header that are forward references.
rdar://21135249

Swift SVN r30941
2015-08-03 05:27:11 +00:00
Argyrios Kyrtzidis
d9032c0e39 [IDE] Make sure that ClangImporter::lookupDeclsFromHeader forwards to the passed in filter
function and that filter receives macros as well.

Swift SVN r28971
2015-05-23 20:20:27 +00:00
Argyrios Kyrtzidis
9917e74533 [IDE] Support printing the header interface for a header, that belongs to a clang module
that the clang invocation is importing.

Fully addresses rdar://21067984

Swift SVN r28962
2015-05-23 08:14:59 +00:00
Argyrios Kyrtzidis
054ebaaa3c [IDE] Handle properly the clang flag '-fmodule-implementation-of' when doing header interface printing.
Part of rdar://21067984

Swift SVN r28961
2015-05-23 08:14:57 +00:00
Argyrios Kyrtzidis
42cc79b27a [test] Move inputs for test/IDE/print_clang_header.swift to their own subdirectory. NFC.
Swift SVN r28960
2015-05-23 08:14:54 +00:00