Commit Graph

226 Commits

Author SHA1 Message Date
QuietMisdreavus
a75f94eef4 [6.2] use RespectOriginallyDefinedIn when mangling extension contexts (#82657)
- **Explanation**: USR mangling can include an extension context infix
(`AAE`) when an extended type uses `@_originallyDefinedIn` on platforms
other than the active one. This adds a check for the
`RespectOriginallyDefinedIn` flag when checking extension decls against
their extended type.
- **Scope**: Changes USR mangling in these situations so that USRs are
the same for the same code regardless of platform.
- **Issues**: rdar://152598492
- **Original PRs**: https://github.com/swiftlang/swift/pull/82348
- **Risk**: Low. The change is limited to situations where the name
mangler is already disrespecting the alternate module name, and only
additionally turns on that flag for any USR mangling.
- **Testing**: Automated tests
- **Reviewers**: @edymtt @augusto2112
2025-07-01 00:30:15 -07:00
Allan Shortlidge
f774d4a3b3 Merge pull request #82151 from tshortli/rhombicuboctahedron-6.2
[6.2] Upstream support for the Xcode 26 SDKs
2025-06-10 21:57:12 -07:00
QuietMisdreavus
879cbf67fc [6.2] [SymbolGraphGen] distinguish between headers of the same name in different modules (#82120)
- **Explanation**: Makes SymbolGraphGen use fully-qualified module names
when comparing modules for determining symbol sources.
- **Scope**: Fixes an uncommon bug when extending an Objective-C type
using a header with the same name as the source module's header.
- **Issues**: rdar://152676102
- **Original PRs**: #82112
- **Risk**: Low. The change does not affect normal compilation, and the
change will only affect which symbol graph a symbol is sorted into, and
shouldn't introduce any crashes.
- **Testing**: Automated tests verify the change.
- **Reviewers**: @franklinsch
2025-06-10 10:11:46 -07:00
Allan Shortlidge
c674abe2e2 Tests: Correct invalid platform versions in @available attributes. 2025-06-10 08:22:38 -07:00
QuietMisdreavus
61c4a0311f [6.2] [SymbolGraphGen] add flags to filter platforms out of availability metadata (#80806)
rdar://144379124
2025-04-21 14:48:43 -06:00
Pavel Yaskevich
3bb3a0744f [AST] ASTPrinter: Make sure that attributes are printed as attributes and specifiers as keywords
(cherry picked from commit e302d73c87)
2025-04-17 11:46:13 -07:00
QuietMisdreavus
f5c531c8f9 only recurse public-private type aliases from Clang (#79996)
rdar://145980187
2025-03-31 09:10:58 -06:00
Dylan Sturgeon
2c8e337f25 Merge pull request #80074 from dylansturg/objc_enum_refs
The Error enum synthesized declarations, e.g. the struct and its static accessors, should generally appear to be identical to the underlying Clang definitions. There are some specific use cases where the synthesized declarations are necessary though.

I've added an option for USR generation to override the Clang node and emit the USR of the synthesized Swift declaration. This is used by SwiftDocSupport so that the USRs of the synthesized declarations are emitted.

Fixes 79912
2025-03-25 11:21:21 +00:00
Doug Gregor
e24598bca1 Use a marker protocol SendableMetatype to model T.Type: Sendable
Introduce a marker protocol SendableMetatype that is used to indicate
when the metatype of a type will conform to Sendable. Specifically,
`T: SendableMetatype` implies `T.Type: Sendable`. When strict
metatype sendability is enabled, metatypes are only sendable when `T:
SendableMetatype`.

All nominal types implicitly conform to `SendableMetatype`, as do the
various builtin types, function types, etc. The `Sendable` marker
protocol now inherits from `SendableMetatype`, so that `T: Sendable`
implies `T.Type: Sendable`.

Thank you Slava for the excellent idea!
2025-02-13 22:48:05 -08:00
QuietMisdreavus
57450f5d18 [SymbolGraphGen] Un-revert #78959 and clean up usage of DenseMap (#79124)
* Revert "Revert "[SymbolGraphGen] synthesize child symbols for type aliases of private…" (#79062)"

This reverts commit cac82978bc.

* clean up use of DenseMap in SymbolGraphGen

rdar://143865173
2025-02-06 08:34:16 -07:00
QuietMisdreavus
cac82978bc Revert "[SymbolGraphGen] synthesize child symbols for type aliases of private…" (#79062)
This reverts commit b1871fb333.
2025-01-30 19:38:41 -08:00
QuietMisdreavus
ab26b8b9d7 add support to getTopLevelDecls for clang submodules (#76401)
rdar://126031510
2025-01-30 09:39:58 -07:00
QuietMisdreavus
b1871fb333 [SymbolGraphGen] synthesize child symbols for type aliases of private decls (#78959) 2025-01-29 12:39:26 -07:00
Daniel Rodríguez Troitiño
5abb1ea6ac [test] Remove some REQUIRES: for features not longer used in those files
While doing #76740 I iteratively was adding new `REQUIRES:` as new
usages of the features were found, but I did not realize that at the
same time other people might be removing some of those usages. The tests
in this commit had some `REQUIRES:` line for a previous
`-enable-experimental/upcoming-feature`, but they not longer use those
features, so the `REQUIRES:` were effectively disabling the tests (at
least in the case of `KeyPathWithStaticMembers`. In other cases they
might still had executed).
2024-11-04 20:53:07 -08:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
QuietMisdreavus
108ad6f115 fix nondeterminism in OptionalRequirementOf test (#77276)
rdar://138773605
2024-10-31 14:18:34 -06:00
David Rönnqvist
b8481da042 Include explicitly unnamed parameter names in function signature (#77222)
rdar://138630917
2024-10-30 15:29:53 -07:00
azharudd
560fe75031 Merge pull request #77212 from bnbarham/2024-rebranch-to-main
Update LLVM to stable/20240723
2024-10-28 16:02:02 -07:00
QuietMisdreavus
d5d00011f3 [SymbolGraphGen] improve handling of underscored protocols (#77251)
* treat children of underscored protocols as public

Children of underscored protocols should be treated as native children
of their conforming types. To accomplish this, ignore underscored
protocols in the isInherentlyPrivate check.

rdar://124483146

* include underscored protocol methods even when skipping protocols

rdar://128143861
2024-10-28 13:44:03 -07:00
swift-ci
6ea9995a81 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-19 18:57:20 -07:00
Allan Shortlidge
cb578172ea Tests: Remove -disable-availability-checking in more tests that use concurrency.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
2024-10-19 12:35:20 -07:00
swift-ci
2b5ffa0941 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-18 15:52:56 -07:00
QuietMisdreavus
2f184f7bac don't emit both requirementOf and optionalRequirementOf for the same relationship (#76983)
rdar://83519993
2024-10-18 16:48:39 -06:00
swift-ci
415b83acd6 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-24 05:54:22 -07:00
Hamish Knight
73baf7d690 [test] Tweak a SymbolGraph test
Add `-wmo` to the invocation to ensure we don't
end up doing merge-modules, which makes the test
consistent across both the old and new driver.
2024-09-22 21:15:45 +01:00
swift-ci
3a84dea9bb Merge remote-tracking branch 'origin/main' into rebranch 2024-08-22 08:54:27 -07:00
Ben Langmuir
fd1875dcfb [test] Move availability tests to later fake OS versions
10.50 was once greater than any real macOS version, but now it compares
less than real released versions, which makes these tests depend on the
deployment target unnecessarily. Update these tests to use even larger
numbers to hopefully keep them independent a little longer.
2024-08-21 11:38:54 -07:00
swift-ci
21575354f7 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-15 14:55:35 -07:00
QuietMisdreavus
bafe819e8d don't drop underscored protocol implementation symbols (#75848)
rdar://133086270
2024-08-15 14:41:17 -07:00
swift-ci
fa1860c1db Merge remote-tracking branch 'origin/main' into rebranch 2024-08-13 08:08:08 -07:00
Daniel Grumberg
3b093d7938 Avoid recursing into non swift modules when collecting exported imports (#75619)
rdar://132593532
2024-08-13 09:05:50 -06:00
Becca Royal-Gordon
fd84e7273d Rename module.map -> module.modulemap in tests
The legacy `module.map` spelling of module map files was deprecated by llvm/llvm-project#75142 and clang expects to remove support for them in the future. Switch all tests to use the supported spelling.

Fixes rdar://128431478.
2024-08-12 17:47:26 -07:00
Alex Hoppen
eec3d752cb Inherit doc comments from default implementations of inherited protocols
For example when we have

```swift
protocol BaseProtocol {}

extension BaseProtocol {
  /// Say hello
  func hello() { }
}
struct MyStruct: BaseProtocol {
  func hello() {}
}
```

Then `MyStruct.hello` should inherit the doc comment from the implementation of `BaseProtocol.hello`. Currently no doc comment is associated with `MyStruct.hello`.

rdar://126240546
2024-08-02 11:26:51 -07:00
Hamish Knight
bfa3ad063d [ASTPrinter] Print some as a keyword
This is consistent with how the TypeRepr is
printed.
2024-07-13 14:55:35 +01:00
Joseph Heck
d3ff97dfc0 inspects class to determine if its a class, actor, or distributed actor for symbol graph generation (#74155)
rdar://84751310
2024-06-25 09:37:35 -06:00
Daniel Grumberg
d960101422 Add test to check nested exported imports in SymbolGraphGen 2024-04-25 11:33:15 +01:00
Daniel Grumberg
9964884809 Recursively collect exported imports to allow fetching all visible Decls for symbol graph generation
This change is two fold. Firstly it enables collection of exported
imports from non source file units. Additionally this recurses through
the exported imports to ensure the transitive set is collected.

Fixes https://github.com/apple/swift/issues/59920
rdar://89687175
2024-04-25 11:33:11 +01:00
QuietMisdreavus
27443e03ab fix test to match multiple lines at once (#72396) 2024-03-19 08:36:35 -06:00
Sofía Rodríguez
082f2b01c9 [SymbolGraphGen] Import ObjC forward declarations by default. (#71947)
rdar://123279176
2024-03-04 17:29:18 -08:00
Slava Pestov
892dd4594d SymbolGraph: Fixes for noncopyable generics and some small cleanups 2024-03-01 12:55:08 -05:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
David Rönnqvist
24d54a8614 [SymbolGraphGen] Emit "functionSignature" info for initializers and subscripts (#70207)
rdar://111072228
2023-12-20 10:56:01 -07:00
Michael Spencer
b2640e15e4 [test] Rename all module.map files to module.modulemap
`module.map` as a module map name has been discouraged since 2014, and
Clang will soon warn on its usage. This patch renames all instances of
`module.map` in the Swift tests to `module.modulemap` in preparation
for this change to Clang.

rdar://106123303
2023-08-21 15:58:59 -07:00
QuietMisdreavus
632f0a33b9 don't emit symbols and protocols from unconditionally unavailable extensions (#67539)
rdar://112137607
2023-07-26 15:04:25 -06:00
Daniel Rodríguez Troitiño
70376a15f0 [ScanDependencies] Fix JSON generation under certain circunstances. (#67246)
The code of `ScanDependencies.cpp` was creating invalid JSON since #66031
because in the case of having `extraPcmArgs` and `swiftOverlayDependencies`,
but not `bridgingHeader`, a comma will not be added at the end of
`extraPcmArgs`, creating an invalid JSON file. Additionally that same PR
added a trailing comma at the end of the `swiftOverlayDependencies`, which
valid JSON does not allow, but that bug was removed in #66366.

Both problems are, however, present in the 5.9 branch, because #66936
included #66031, but not #66366.

Besides fixing the problem in `ScanDependencies.cpp` I modified every test
that uses `--scan-dependencies` to pass the produced JSON through
Python's `json.tool` in order to validate proper JSON is produced. In
most cases I was able to pipe the output of the tool into `FileCheck`,
but in some cases the validation is done by itself because the checks
depend on the exact format generated by `--scan-dependencies`. In
a couple of tests I added a call to `FileCheck` that seemed to be
missing.

Without these changes, two tests seems to be generating invalid JSON in
my machine:

- `ScanDependencies/local_cache_consistency.swift` (which outputs `Expecting ',' delimiter: line 525 column 11 (char 22799)`)
- `ScanDependencies/placholder_overlay_deps.swift`
2023-07-12 14:19:20 -07:00
QuietMisdreavus
85d59d2e55 don't use Clang modules in the "only re-export public symbols" check (#66610)
rdar://110399757
2023-06-15 10:13:18 -06:00
QuietMisdreavus
e45c9df2a3 always use the argNames constructor for macro DeclNames (#66497)
rdar://110179186
2023-06-12 09:10:02 -06:00
Doug Gregor
cfda29ccd4 [SE-0397] Enable freestanding declaration macros by default.
This proposal has been accepted. Move the feature flag from "experimental"
to "always enabled". Tracked by rdar://108637367.
2023-05-24 09:16:55 -07:00
QuietMisdreavus
e120a82e0c [SymbolGraphGen] refactor protocol conformance inheritance checking (#66012)
rdar://109418762
2023-05-22 09:27:58 -06:00
QuietMisdreavus
34faa58b52 [ClangImporter] don't add swift_attr files to a module's auxiliary files (#65867)
rdar://107624995
2023-05-17 09:10:13 -06:00