Doug Gregor
a0d52344bb
Merge pull request #67513 from DougGregor/freestanding-macros-step-into-the-light
2023-07-25 20:44:29 -07:00
Alex Lorenz
d7b62b3c40
[cxx-interop] add 'upcoming-swift' compat version
...
This version will be used to gate new source breaking changes for C++ interoperability
2023-07-25 16:19:58 -07:00
Steven Wu
b9fef33891
Merge pull request #67263 from cachemeifyoucan/eng/PR-explicit-module-interface-check
...
[ExplicitModule] Allow typecheck-module-from-interface using explicit module
2023-07-25 16:10:48 -07:00
Ben Barham
9691060418
[Diagnostics] Add declaration name to macro_attached_to_invalid_decl
...
This could also use `%kind` for the declaration kind, but that ends up
being "extension of struct" instead of just "extension", which seems
slightly worse.
2023-07-25 16:03:52 -07:00
Ben Barham
18cb5f4f3d
[Diagnostics] Update in_macro_expansion note for attached macros
...
Use the attached atttribute's location as the location of the macro,
rather than the location of the declaration it's attached to. Also add
the kind and name of that declaration to the note itself.
2023-07-25 16:03:52 -07:00
Doug Gregor
6ac69d8c3c
Remove findMacroForCustomAttr in favor of namelookup::lookupMacros
...
The former was effectively a copy of the latter.
2023-07-25 14:16:50 -07:00
Doug Gregor
f0f74e6c5e
[Macros] Don't allow types to shadow freestanding macros.
...
When performing name lookup for freestanding macros (e.g., after the
`#`), don't allow types to shadow macros from imported libraries.
Fixes rdar://110429368.
2023-07-25 11:34:25 -07:00
Slava Pestov
f07495dd64
AST: Add TypePosition::Shape
2023-07-25 02:47:46 -04:00
Slava Pestov
747b060389
RequirementMachine: Correct desugaring of same-type requirements with pack expansion on both sides
2023-07-25 02:47:45 -04:00
Nate Chandler
a1d10997da
[SIL] Promoted least-common ancestor to Dominance.
...
It's a general purpose helper and there will soon be another user.
2023-07-24 16:57:14 -07:00
Joe Groff
aee071bf4e
Introduce an experimental @_rawLayout attribute.
...
This attribute can be attached to a noncopyable struct to specify that its
storage is raw, meaning the type definition is (with some limitations)
able to do as it pleases with the storage. This provides a basis for
implementing types for things like atomics, locks, and data structures
that use inline storage to store conditionally-initialized values.
The example in `test/Prototypes/UnfairLock.swift` demonstrates the use
of a raw layout type to wrap Darwin's `os_unfair_lock` APIs, allowing
a lock value to be stored inside of classes or other types without
needing a separate allocation, and using the borrow model to enforce
safe access to lock-guarded storage.
2023-07-24 14:28:19 -07:00
Evan Wilde
669285fd17
Merge pull request #65534 from stephank/fix/cmake-3.25
...
build: fix accidental cmake expansions
2023-07-24 09:44:14 -07:00
Saleem Abdulrasool
d163261cef
Merge pull request #67453 from compnerd/libc
...
Option: add `-libc` as an option for Swift tools
2023-07-22 09:28:47 -07:00
Pavel Yaskevich
dbb38f1bf3
Merge pull request #67435 from xedin/rdar-112029630
...
[CSRanking] Augment overload ranking to account for variadic generics
2023-07-21 09:44:01 -07:00
eeckstein
b9d0aa34e1
Merge pull request #67395 from eeckstein/redundant-load-elimination
...
Optimizer: re-implement the RedundantLoadElimination pass in Swift
2023-07-21 13:58:19 +02:00
Saleem Abdulrasool
200563c2e6
Option: add -libc as an option for Swift tools
...
Ensure that we process `-libc` in `swift-symbolgraph-extract` and
`swift-api-extract`. This option is used by Windows to determine the C
ABI to use and thus impacts the ABI exposed by the ClangImporter to the
Swift interface. This partially enables the use of
`swift package dump-symbol-graph` on Windows.
2023-07-21 04:31:59 -07:00
Erik Eckstein
5b3c34b9e7
fix a linking problem in swift-frontend
...
Sometimes when building the SwiftCompilerSources with a host compiler, linking fails with unresolved symbols for DenseMap and unique_ptr destroys.
This looks like a problem with C++ interop: the compiler thinks that destructors for some Analysis classes are materialized in the SwiftCompilerSources, but they are not.
Explicitly defining those destructors fixes the problem.
2023-07-21 08:01:31 +02:00
Erik Eckstein
29246fd80b
AliasAnalysis: add complexity budget for the getMemEffectsFunction
2023-07-21 07:19:56 +02:00
Erik Eckstein
2384a0c6f4
Optimizer: remove the now unused LSLocation utilities
2023-07-21 07:19:56 +02:00
Erik Eckstein
4d20423e00
Optimizer: re-implement the RedundantLoadElimination pass in Swift
...
The new implementation has several benefits compared to the old C++ implementation:
* It is significantly simpler. It optimizes each load separately instead of all at once with bit-field based dataflow.
* It's using alias analysis more accurately which enables more loads to be optimized
* It avoids inserting additional copies in OSSA
The algorithm is a data flow analysis which starts at the original load and searches for preceding stores or loads by following the control flow in backward direction.
The preceding stores and loads provide the "available values" with which the original load can be replaced.
2023-07-21 07:19:56 +02:00
Erik Eckstein
f623a879ce
Swift Optimizer: add LoadInst.set(ownership:)
2023-07-21 07:19:12 +02:00
Erik Eckstein
ff913d2fa6
Swift Optimizer: add the FunctionPassContext.swiftArrayDecl API
2023-07-21 07:19:12 +02:00
Erik Eckstein
ee3d702019
Swift SIL: add NominalTypeDecl.isStructWithUnreferenceableStorage
2023-07-21 07:19:12 +02:00
Erik Eckstein
2baaf4890e
Swift SIL: add a few new create functions in Builder
2023-07-21 07:19:12 +02:00
Erik Eckstein
2e9de24e2a
Swift Optimizer: add the SSAUpdater utility
2023-07-21 07:19:12 +02:00
Holly Borla
8091744296
Merge pull request #67428 from hborla/dependent-type-pack-syntax
...
[Type Resolution] Only allow `each` applied directly to a type parameter pack.
2023-07-20 20:12:32 -07:00
swift-ci
7741409f8e
Merge pull request #67075 from beccadax/kinder-diagnostics
...
Improve DiagnosticEngine's handling of ValueDecl arguments
2023-07-20 18:26:14 -07:00
swift-ci
c3c84d3625
Merge pull request #67421 from JTurcotti/more-diags
...
[SendNonSendable] Improve diagnostics and fix bugs
2023-07-20 16:56:56 -07:00
Holly Borla
7b586d20cc
[Type Resolution] Only allow each applied directly to a type parameter pack.
2023-07-20 15:29:53 -07:00
Becca Royal-Gordon
fe6753485f
[NFC] Adopt new diagnostic features across Sema
2023-07-20 15:23:47 -07:00
jturcotti
853ef7cf3c
fix bugs that present themselves when handling multiarg and varargs functions, including adding better debug dump methods
2023-07-20 14:01:08 -07:00
Pavel Yaskevich
59908eeb0d
[CSGen] Suppress favoring in presence of non-disfavored variadic generic overloads
...
Since this type of early favoring checks number of arguments and matches
labels it would always favor non-variadic overloads which is incorrect.
2023-07-20 10:02:59 -07:00
Sophia Poirier
60c579c001
Merge pull request #67415 from sophiapoirier/remove-TupleType-isSingleUnlabeledPackExpansion
...
[ConstraintSystem] remove TupleType::isSingleUnlabeledPackExpansion in favor of constraints::getPatternTypeOfSingleUnlabeledPackExpansionTuple
2023-07-20 09:43:14 -07:00
Holly Borla
f76783d619
Merge pull request #67405 from hborla/enable-extension-macros
...
[Macros] Remove the `ExtensionMacros` experimental feature flag.
2023-07-19 17:59:21 -07:00
jturcotti
a83d7aa39c
improve diagnostics about data races; highlight the individual expressions being sent and accessed as precisely as possible, and include information about specific non-sendable types and isolation crossings
2023-07-19 17:27:16 -07:00
Slava Pestov
2473c3b45c
Merge pull request #67404 from slavapestov/keypath-descriptor-crash-with-variadics
...
Don't emit keypath descriptors for unsupported cases involving variadic generics
2023-07-19 20:01:18 -04:00
Sophia Poirier
8173c721eb
[ConstraintSystem] remove TupleType::isSingleUnlabeledPackExpansion in favor of constraints::getPatternTypeOfSingleUnlabeledPackExpansionTuple
2023-07-19 15:10:40 -07:00
Zoe Carver
7db5fe11ad
Merge pull request #67296 from zoecarver/only-methods-on-self-contained-types-are-unsafe
...
[cxx-interop] Only mark projections of self-contained types as unsafe.
2023-07-19 14:18:46 -07:00
nate-chandler
445a65479b
Merge pull request #67397 from nate-chandler/opaque-values/20230719/1/emit_end_borrows/begin_apply
...
[AddressLowering] End borrow scopes for begin_apply at coro endpoints.
2023-07-19 14:08:41 -07:00
Steven Wu
67e919f632
Merge pull request #67229 from cachemeifyoucan/eng/PR-dep-scan-avoid-repeated-cmd-update
...
[DependencyScan] Prevent command-line flags added again on re-scan
2023-07-19 13:44:38 -07:00
Slava Pestov
04fe8f4bc6
SIL: Add forEachExpandedPackElement() and use it in type lowering
...
Probably there's no way to hit this right now, but there will be if
concrete formal PackTypes start showing up in AST.
2023-07-19 16:24:38 -04:00
Slava Pestov
8a07466938
SIL: Fix SubstFunctionTypePatternVisitor handling of pack types
...
The included test case also covers the previous commit.
2023-07-19 16:24:27 -04:00
Becca Royal-Gordon
9c6b3bb6ff
Adopt %kind in diag::objc_overriding_objc_decl
...
Slightly alters wording of a diagnostic.
2023-07-19 13:08:13 -07:00
Becca Royal-Gordon
325ab9118e
[NFC] Adopt new features in availability diagnostics
...
Allows the removal of a helper function.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
1d6b041e58
Reword @objcImpl diagnostics to avoid “an”
...
…and also adopt new DiagnosticEngine features.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
fca140211d
Adopt warnUntilSwiftVersion for diag::witness_not_usable_from_inline_warn
...
This changes the wording of some diagnostics in Swift 4.2 and Swift 4 modes.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
b4855aee1f
Adopt ValueDecl in autodiff diagnostics
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
025728f568
Adopt ValueDecl for invalid redeclaration errors
...
Causes slight changes to notes on certain `init`s.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
09e20776cb
Remove diag::descriptive_decl_declared_here
...
It was used in one place to handle accessors, which happily is no longer necessary.
2023-07-19 13:08:12 -07:00
Becca Royal-Gordon
1b81c3de7b
[NFC] Adopt ValueDecl * for decl_declared_here
2023-07-19 13:08:12 -07:00