Arnold Schwaighofer
36a3c6e611
Merge pull request #85644 from aschwaighofer/wip_embedded_exits_with_eriks_changes_v1
...
[embedded] Fix associated type conformances for specialized witness tables
2025-12-01 16:40:31 -08:00
Erik Eckstein
a371aecb95
AST: add var ClassDecl.isForeign
2025-11-21 16:33:06 +01:00
Erik Eckstein
1486d009b0
AST: add var ProtocolDecl.isMarkerProtocol
2025-11-20 10:56:05 -08:00
Daniil Kovalev
a172134162
Address review comments
2025-11-18 01:46:49 +03:00
Daniil Kovalev
c12819f881
Address review comments
2025-11-17 14:13:09 +03:00
Daniil Kovalev
f0bf57a269
Resolve merge conflicts & address review comments
2025-11-10 19:18:25 +03:00
Daniil Kovalev
02fcd218d7
Address review comments
2025-10-15 05:14:15 +03:00
Daniil Kovalev
b3d31c7d51
Bridging: Implement bridges required for ongoing AutoDiff changes
...
In #83926 , part of the changes resolving #68944 is submitted. The AutoDiff
closure specialization optimizer pass relies on several bridges not
implemented yet.
This patch introduces these missing bridges. See the list of the changes below.
**AST:**
* Define `.asValueDecl` on each BridgedXXXDecl type that's also a ValueDecl.
* Define `.asNominalTypeDecl` on each BridgedXXXDecl type that's also a NominalTypeDecl.
* Define `.asGenericContext` on each BridgedXXXDecl type that's also a GenericContext.
* `class BridgedSourceFile`:
- Make nullable
- `func addTopLevelDecl(_ decl: BridgedDecl)`
* `class BridgedFileUnit`:
- `func castToSourceFile() -> BridgedNullableSourceFile`
* `class BridgedDecl`:
- `func getDeclContext() -> BridgedDeclContext`
* `class BridgedParamDecl`:
- `func cloneWithoutType() -> BridgedParamDecl`
- `func setInterfaceType(_ type : BridgedASTType)`
* Define `BridgedDecl.setImplicit()` instead of `BridgedParamDecl.setImplicit()`
* `class BridgedGenericContext`:
- `setGenericSignature(_ genSig: BridgedGenericSignature)`
* Change return type of `BridgedEnumDecl.createParsed(/*...*/)` from `BridgedNominalTypeDecl` to `BridgedEnumDecl`
* `class BridgedValueDecl`:
- `func setAccess(_ accessLevel: swift.AccessLevel)`
* `class BridgedNominalTypeDecl`:
- `func addMember(_ member: BridgedDecl)`
* `class BridgedGenericTypeParamDecl`:
- `func createImplicit(declContext: BridgedDeclContext, name: swift.Identifier, depth: UInt, index: UInt, paramKind: swift.GenericTypeParamKind)`
* `class ValueDecl`:
- `var baseIdentifier: swift.Identifier`
* `class NominalTypeDecl`:
- `var declaredInterfaceType: Type`
* `class EnumElementDecl`:
- `var parameterList: BridgedParameterList`
- `var nameStr: StringRef`
* `struct GenericSignature`:
- `var canonicalSignature: CanGenericSignature`
* `struct CanGenericSignature`:
- `var isEmpty: Bool`
- `var genericSignature: GenericSignature`
* `struct Type`:
- `func mapTypeOutOfContext() -> Type`
- `func getReducedType(sig: GenericSignature) -> CanonicalType`
- `func GenericTypeParam_getName() -> swift.Identifier`
- `func GenericTypeParam_getDepth() -> UInt`
- `func GenericTypeParam_getIndex() -> UInt`
- `func GenericTypeParam_getParamKind() -> swift.GenericTypeParamKind`
* `struct CanonicalType`:
- `func SILFunctionType_getSubstGenericSignature() -> CanGenericSignature`
- `func loweredType(in function: SIL.Function) -> SIL.Type`
**SIL:**
* `class Argument`:
- `func replaceAllUsesWith(newArg: Argument)`
* `class BasicBlock`:
- `func insertPhiArgument(atPosition: Int, type: Type, ownership: Ownership, _ context: some MutatingContext) -> Argument`
* `struct Builder`:
- `func createTuple(elements: [Value]) -> TupleInst`
* `protocol Context`:
- `func getTupleType(elements: [AST.Type]) -> AST.Type`
- `func getTupleTypeWithLabels(elements: [AST.Type], labels: [swift.Identifier]) -> AST.Type`
* `class Function`:
- `var sourceFile: BridgedNullableSourceFile`
- `func mapTypeIntoContext(_ type: Type) -> Type`
* `class PartialApplyInst`:
- `var substitutionMap: SubstitutionMap`
* `class SwitchEnumInst`:
- `var numCases: Int`
- `public func getSuccessorForDefault() -> BasicBlock?`
* `Type`:
- `var category: ValueCategory`
- `func getEnumCasePayload(caseIdx: Int, function: Function) -> Type`
- `func mapTypeOutOfContext() -> Type`
- `static func getPrimitiveType(canType: CanonicalType, silValueCategory: ValueCategory) -> Type`
* `struct EnumCase`:
- `let enumElementDecl: EnumElementDecl`
* `struct TupleElementArray`:
- `func label(at index: Int) -> swift.Identifier`
* Define `enum ValueCategory` with `address` and `object` elements
2025-10-06 17:56:38 +03:00
Erik Eckstein
0a953b60ca
SIL/AST: add var InjectEnumAddrInst.element and var EnumElementDecl.hasAssociatedValues
2025-08-03 11:06:15 +02:00
Erik Eckstein
d025e9f7a5
SIL: add var Argument.decl: ValueDecl?
2025-06-20 08:14:58 +02:00
Pavel Yaskevich
202907d0f6
[CompilerSources] Register using declaration
2025-05-30 15:52:18 -07:00
Erik Eckstein
28985f4d41
Swift AST: add var EnumDecl.hasRawType
2025-05-29 08:12:17 +02:00
Erik Eckstein
2020897459
Swift AST: add some Decl APIs
...
* in `Decl`: `var parent: Decl?`
* in `ProtocolDecl`: `var requiresClass: Bool`
2025-04-18 06:58:38 +02:00
Artem Chikin
281f84da0f
[Compile Time Values] Rewrite the 'Diagnose Unknown Compile Time Values' diagnostic pass in Swift
2025-03-28 10:30:07 -07:00
Erik Eckstein
42bba8f484
AST: add some Declaration APIs
...
* `var Declaration.parentModule`
* `var AbstractFunctionDecl.isOverridden`
2025-03-26 07:30:11 +01:00
Rintaro Ishizaki
002d7d7cdf
[Parse/AST] Remove PoundDiagnosticDecl
...
There is no reson to make a AST node for '#error' and '#warning'
directives. Parser knows the diagnostics should be emitted or not.
2025-03-07 21:48:01 -08:00
Erik Eckstein
f53635911c
Swift AST: add var Decl.hasClangNode
2025-01-27 09:59:48 +01:00
Mykola Pokhylets
cb7a8d5cfc
Disable stack promotion for classes with isolated deinit
2024-10-31 20:43:11 +01:00
Erik Eckstein
1856e7f68a
SwiftCompilerSources: add the ValueDecl.isObjC API
2024-10-08 16:23:22 +02:00
Erik Eckstein
10782cf42b
SwiftCompilerSources: introduce the AST module
...
As the optimizer uses more and more AST stuff, it's now time to create an "AST" module.
Initially it defines following AST datastructures:
* declarations: `Decl` + derived classes
* `Conformance`
* `SubstitutionMap`
* `Type` and `CanonicalType`
Some of those were already defined in the SIL module and are now moved to the AST module.
This change also cleans up a few things:
* proper definition of `NominalTypeDecl`-related APIs in `SIL.Type`
* rename `ProtocolConformance` to `Conformance`
* use `AST.Type`/`AST.CanonicalType` instead of `BridgedASTType` in SIL and the Optimizer
2024-10-02 07:10:29 +02:00