Commit Graph

2173 Commits

Author SHA1 Message Date
Steven Wu
47b3efdb6e [Macro] Add a new macro loading option that do not involve searching
Add flag `-load-resolved-plugin` to load macro plugin, which provides a
pre-resolved entry into PluginLoader so the plugins can be loaded based
on module name without searching the file system. The option is mainly
intended to be used by explicitly module build and the flag is supplied
by dependency scanner.
2024-10-31 10:56:21 -07:00
Hamish Knight
2d7500eda6 [AST] Remove ParenType
Today ParenType is used:

1. As the type of ParenExpr
2. As the payload type of an unlabeled single
   associated value enum case (and the type of
   ParenPattern).
3. As the type for an `(X)` TypeRepr

For 1, this leads to some odd behavior, e.g the
type of `(5.0 * 5).squareRoot()` is `(Double)`. For
2, we should be checking the arity of the enum case
constructor parameters and the presence of
ParenPattern respectively. Eventually we ought to
consider replacing Paren/TuplePattern with a
PatternList node, similar to ArgumentList.

3 is one case where it could be argued that there's
some utility in preserving the sugar of the type
that the user wrote. However it's really not clear
to me that this is particularly desirable since a
bunch of diagnostic logic is already stripping
ParenTypes. In cases where we care about how the
type was written in source, we really ought to be
consulting the TypeRepr.
2024-10-31 11:32:40 +00:00
Allan Shortlidge
daf87c06fe Serialization: Serialize the IsForEmbedded bit on @available attributes. 2024-10-30 14:29:45 -07:00
Allan Shortlidge
0e4c881eb3 AST: Store the IsSPI bit of AvailableAttr inline in DecAttribute.
Reduces the layout requirements for `AvailableAttr` by one byte.
2024-10-30 14:29:45 -07:00
Kuba Mracek
350fc386f2 Fix missing serialization type registration code on Builtin.FixedArray 2024-10-28 21:40:48 -07:00
Pavel Yaskevich
6cb4b59489 Merge pull request #77216 from xedin/add-swift-compiler-version
[Frontend/AST] Add `-interface-compiler-version` option to frontend/modules
2024-10-28 21:06:47 -07:00
Pavel Yaskevich
84a62fc170 [Frontend/Serialization] Narrow -swift-compiler-version to -interface-compiler-version
It might be unexpected to future users that `-swift-compiler-version`
would produce a version aligned to .swiftinterface instead of one used
to build the .swiftmodule file. To avoid this possible confusion, let's
scope down the version to `-interface-compiler-version` flag and
`SWIFT_INTERFACE_COMPILER_VERSION` option in the module.
2024-10-28 13:45:27 -07:00
Pavel Yaskevich
83995f2ae0 [Frontend] Don't set "current" compiler version for modules built from swiftinterface
If swiftinterface doesn't have `-swift-compiler-version` flag
it means that it was generated with an older version of the
Swift compiler. In such cases it would be incorrect to use
"current" compiler version because the field is intended to
indicate the compiler the swiftinterface was built with.
2024-10-25 17:05:16 -07:00
Pavel Yaskevich
ab4d8f61eb [Serialization] Add -swift-compiler-version option to swiftmodules 2024-10-25 09:53:40 -07:00
Ben Barham
746517c9f2 Merge remote-tracking branch 'origin/main' into manually-merge-main-to-rebranch
Conflicts:
  - `test/IRGen/has_symbol.swift` test updates in rebranch. The new test
    will fail, will fix in the next commit.
2024-10-24 14:20:17 -07:00
Joe Groff
a184782a38 Introduce a Builtin.FixedArray type.
`Builtin.FixedArray<let N: Int, T: ~Copyable & ~Escapable>` has the layout of `N` elements of type `T` laid out
sequentially in memory (with the tail padding of every element occupied by the array). This provides a primitive
on which the standard library `Vector` type can be built.
2024-10-22 16:21:45 -07:00
swift-ci
8a2edbc4c5 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-11 17:05:06 -07:00
Nate Chandler
df1c4f6b25 [CoroutineAccessors] Add new SILFnTy CoroKind.
For `modify` and `read` coroutines, produce SILFunctionType's whose
coroutineKind is ::YieldOnce2.
2024-10-11 08:25:02 -07:00
swift-ci
43530d6fb5 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-08 23:54:07 -07:00
Akira Hatanaka
9c44b79189 [SILGen] Fix the type of closure thunks that are passed const reference structs (#76903)
The thunk's parameter needs the @in_guaranteed convention if it's a
const reference parameter. However, that convention wasn't being used
because clang importer was removing the const reference from the
type and SILGen was computing the type of the parameter based on the
type without const reference.

This commit fixes the bug by passing the clang function type to
SILDeclRef so that it can be used to compute the correct thunk type.

This fixes a crash when a closure is passed to a C function taking a
pointer to a function that has a const reference struct parameter.

This recommits e074426 with fixes to
serialization/deserialization of function types. The fixes prevent clang
types of functions from being dropped during serialization.

rdar://131321096
2024-10-08 23:44:49 -07:00
swift-ci
f3106c5d40 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-03 15:55:02 -07:00
Adrian Prantl
76649a1d83 [Serialization] Don't filter out unextended-module-map VFS in explicit builds.
In an explicit build LLDB needs to be able import the unmodified .pcms, so
having the exact same flags matters there, and there is no risk of a
recompilation failure, because nothing is recompiled.

rdar://136759808
2024-10-01 15:36:59 -07:00
swift-ci
e5f97d79c5 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-30 07:15:01 -07:00
nate-chandler
ba8f8ea282 Merge pull request #76526 from nate-chandler/general-coro/20240906/1
[CoroutineAccessors] Initial framing.
2024-09-30 07:04:04 -07:00
swift-ci
54d8c9feb0 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-29 14:55:02 -07:00
Hamish Knight
bf6bb650ea Merge pull request #76771 from hamishknight/rename-arg-interface-ty
[AST] NFC: Rename `getArgumentInterfaceType` -> `getPayloadInterfaceType`
2024-09-29 22:53:13 +01:00
Hamish Knight
91ae5d6345 [AST] NFC: Rename getArgumentInterfaceType -> getPayloadInterfaceType
IMO this is a slightly clearer name, many of its
uses already use the term "payload".
2024-09-29 17:05:14 +01:00
swift-ci
f00e29868e Merge remote-tracking branch 'origin/main' into rebranch 2024-09-28 08:15:47 -07:00
Allan Shortlidge
07b84fccfb AST: Introduce ModuleDecl::isClangHeaderImportModule() convenience. 2024-09-27 12:00:03 -07:00
Nate Chandler
091368ba21 [CoroutineAccessors] Added read.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00
Nate Chandler
98a2e6a7df [CoroutineAccessors] Added modify.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00
Ben Barham
c15bc19946 Merge remote-tracking branch 'origin/main' into main-to-rebranch
Conflicts:
  - `lib/Serialization/ModuleFileSharedCore.cpp` new headers on main
2024-09-26 16:01:56 -07:00
Steven Wu
6d78955a0b Merge pull request #76582 from cachemeifyoucan/eng/PR-swift-module-block-block-info
[Serialization] Add missing record into block info block
2024-09-25 14:22:12 -07:00
Steven Wu
fffe2cea19 Merge pull request #76591 from cachemeifyoucan/eng/PR-swift-macro-dep-tracking
[Macro][Dependencies] Properly model macro dependencies in the scanner
2024-09-25 09:41:45 -07:00
Steven Wu
e0541b0357 [Macro][Dependencies] Properly model macro dependencies in the scanner
Add function to handle all macro dependencies kinds in the scanner,
including taking care of the macro definitions in the module interface
for its client to use. The change involves:
  * Encode the macro definition inside the binary module
  * Resolve macro modules in the dependencies scanners, including those
    declared inside the dependency modules.
  * Propagate the macro defined from the direct dependencies to track
    all the potentially available modules inside a module compilation.
2024-09-19 16:41:53 -07:00
swift-ci
ae4fee5d4e Merge remote-tracking branch 'origin/main' into rebranch 2024-09-19 13:54:31 -07:00
Steven Wu
0aba0578b4 [Serialization] Add missing record into block info block
OptionBlocks has missing block record for some of the record types. Add
the missing record types into block info block and order the block
record in the same order as the declaration so it is easier to check for
which kind is missing.
2024-09-19 13:00:06 -07:00
Doug Gregor
5b2520e379 Remove IfConfigDecl from the AST
The swift-syntax tree retains information about the parsed #if
regions. Drop it from the semantic AST.
2024-09-18 20:51:54 -07:00
Ben Barham
a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -07:00
Meghana Gupta
e61d87c01c Add support for parsing @lifetime attribute to specify lifetime dependencies on declarations 2024-09-09 22:02:42 -07:00
Alexis Laferrière
c70162c703 Merge branch 'main' into public-module-name 2024-09-05 20:02:07 -07:00
swift-ci
da55e84c74 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-05 15:35:33 -07:00
Alexis Laferrière
c60fea3aac Sema: Use clearer param name in getPublicModuleName
Use onlyIfImported instead of mustBeVisible.
2024-09-05 12:45:13 -07:00
Alexis Laferrière
214da85183 Sema: Keep public module name in ModuleDecl 2024-09-04 16:20:12 -07:00
Alejandro Alonso
46a4d56c2b Bring back the isOpaqueType parameter for deserialization 2024-09-04 15:13:49 -07:00
Alejandro Alonso
15db739055 Serialize IntegerType
Use BCBlob
2024-09-04 15:13:47 -07:00
Alejandro Alonso
e0f2b812e8 Add serialization and parser tests for SIL 2024-09-04 15:13:47 -07:00
Slava Pestov
b9b6bb7b69 AST: Introduce new kind of sugared GenericTypeParamType
This one just stores an identifier instead of a declaration.
2024-09-04 15:13:46 -07:00
Slava Pestov
1ff1b9479a AST: Pick off some usages of GenericTypeParamType::getDecl() 2024-09-04 15:13:46 -07:00
Alejandro Alonso
f4f60f4344 Remove Value requirement Add GenericTypeParamKind 2024-09-04 15:13:43 -07:00
Alejandro Alonso
75c2cbf593 Implement value generics
Some requirement machine work

Rename requirement to Value

Rename more things to Value

Fix integer checking for requirement

some docs and parser changes

Minor fixes
2024-09-04 15:13:25 -07:00
swift-ci
50d4698d95 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 20:36:09 -07:00
Slava Pestov
e3ff6f0697 AST: Fiddle with GenericEnvironment::forOpenedExistential() again 2024-09-03 17:31:26 -04:00
swift-ci
e27edcada1 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-21 16:49:14 -07:00
Slava Pestov
ae77d6f0c1 AST: Replace one-off predicates with SubstitutionMap::getRecursiveProperties() 2024-08-21 13:19:10 -04:00