Commit Graph

88 Commits

Author SHA1 Message Date
Xi Ge
0992e97e5e ConstValues: record the values of const variable references in the side-car file 2022-02-21 19:22:25 -08:00
Xi Ge
d7d3fe375a Merge pull request #41367 from nkcsgexi/set-up-payload-for-const
ABIChecker: teach ABI descriptor JSON to also keep track of constant values known at compile-time
2022-02-15 11:21:42 -08:00
Xi Ge
23556aee05 ABIChecker: teach ABI descriptor JSON to also keep track of constant values known at compile-time
Emitted at the emit-module step, ABI descriptor is of an entensible JSON format. This patch sets
up a segment in the file to also keep track of all compile-time constant values for other tools
to consume. As the initial step, we only keep track of string literals in the source files.
2022-02-13 21:32:21 -08:00
Slava Pestov
a1c03db381 AST: Generalize ProtocolDecl::getRequirementSignature() to a new RequirementSignature type
The RequirementSignature generalizes the old ArrayRef<Requirement>
which stores the minimal requirements that a conforming type's
witnesses must satisfy, to also record the protocol typealiases
defined in the protocol.
2022-02-13 00:24:23 -05:00
Xi Ge
3ef8165626 ABI checker: refactor the format of the ABI descriptor JSON to be more extensible. NFC 2022-02-12 14:39:51 -08:00
Holly Borla
6e6ca13268 [Type System] Use the constraint type of an existential type in
various places that expect ProtocolType or ProtocoolCompositionType.
2022-01-13 19:30:44 -08:00
Xi Ge
0dbcf79f29 ABI checker: check validity of extended nominals before continue
rdar://87150470
2022-01-10 12:26:58 -08:00
Doug Gregor
a5f676028b Eliminate remaining dependencies on a single underlying opaque type
The first generic parameter of an `OpaqueTypeDecl` was still being used
as the "underlying" interface type of the opaque type, which is
incorrect for both structural and named opaque result types. Eliminate
this notion, because the (declared) interface type already has the
correct structure.

Only ABI checking depended on the old "underlying" type, so rework it to
instead substitute into properly for structural opaque result types as
well.

Deserialization required a small adjustment to eliminate a cycle
because the interface type of an `OpaqueTypeDecl` involves opaque
archetype types, which reference the declaration itself... so
deserialize the interface type later, now that it's correct.
2022-01-04 11:55:42 -08:00
Doug Gregor
b60c88566f Fix serialization for structural opaque result types 2021-12-27 21:18:53 -08:00
Alex Hoppen
63c31033fc [Frontend] Load standard libarary in CompilerInstance::setup
Instead of checking that the stdlib can be loaded in a variety of places, check it when setting up the compiler instance. This required a couple more checks to avoid loading the stdlib in cases where it’s not needed.

To be able to differentiate stdlib loading failures from other setup errors, make `CompilerInstance::setup` return an error message on failure via an inout parameter. Consume that error on the call side, replacing a previous, more generic error message, adding error handling where appropriate or ignoring the error message, depending on the context.
2021-12-13 15:32:08 +01:00
Saleem Abdulrasool
349af3707d Merge pull request #40305 from compnerd/semitruck
gardening: make c++98-compat-extra-semi an error
2021-11-30 08:18:36 -08:00
Saleem Abdulrasool
910fbee14e gardening: make c++98-compat-extra-semi an error
This cleans up 90 instances of this warning and reduces the build spew
when building on Linux.  This helps identify actual issues when
building which can get lost in the stream of warning messages.  It also
helps restore the ability to build the compiler with gcc.
2021-11-27 11:40:17 -08:00
Becca Royal-Gordon
1880118e70 Restructure getDisplayDecl() Sendable forcing
Move this into a helper function that lives in Sema, avoiding libswiftAST calling into libswiftSema.
2021-11-19 17:51:27 -08:00
Artem Chikin
d2b062df49 Revert "ABI checker: use dedicated mangled name field to diagnose mangled name changes"
This reverts commit b937d0da86.
2021-10-25 11:02:21 -07:00
Xi Ge
b937d0da86 ABI checker: use dedicated mangled name field to diagnose mangled name changes 2021-10-21 10:51:19 -07:00
Xi Ge
5cf758d7ff ABI Checker: include mangled names in ABI descriptor files
Previously, we use USR as a delegate for mangled name. However, USR won't incorporate name changes made
by attributes like @_silgen_name. Instead, we should add a dedicated field for canonical mangled names.

rdar://84202064
2021-10-21 10:10:10 -07:00
Xi Ge
fee60ffd4f Revert "ABI Checker: include mangled names in ABI descriptor files"
This reverts commit a870b06055.
2021-10-21 10:09:49 -07:00
Xi Ge
a870b06055 ABI Checker: include mangled names in ABI descriptor files
Previously, we use USR as a delegate for mangled name. However, USR won't incorporate name changes made
by attributes like @_silgen_name. Instead, we should add a dedicated field for canonical mangled names.

rdar://84202064
2021-10-20 20:58:00 -07:00
Nate Chandler
b4291916f2 Merge branch 'main' into rebranch
Conflicts:
        include/swift/SIL/SILBuilder.h
2021-09-15 13:30:12 -07:00
Alexis Laferrière
51cec86085 [APIDigester] Don't check whether the stdlib was built for a different SDK
The API digester forces loading the stdlib which may pick up an stdlib
from a different SDK than the one being tested. Disable the check
enforcing loading only swiftmodules built for the same SDK.
2021-09-13 16:44:16 -07:00
swift-ci
b56685ee37 Merge remote-tracking branch 'origin/main' into rebranch 2021-09-10 13:35:21 -07:00
Hamish Knight
af14bba276 [AST] Simplify AnyFunctionType::composeTuple
Remove the canonicalVararg parameter and
CanParamArrayRef wrapper. Almost none of the
callers want canonicalVararg, and the one that
does calls `getCanonicalType` on the result
anyway.
2021-09-09 21:46:31 +01:00
swift-ci
1996fff7e1 Merge remote-tracking branch 'origin/main' into rebranch 2021-09-06 09:53:04 -07:00
Xi Ge
eb8e52b8d6 ABIChecker: allow retrying when loading ABI descriptor file 2021-09-05 20:07:38 -07:00
swift-ci
8e7ca62491 Merge remote-tracking branch 'origin/main' into rebranch 2021-09-03 19:43:11 -07:00
Xi Ge
a8b95cb9cd ABIChecker: don't fail when hitting EnumCaseDecl
All enum elments should have been handled separately so we don't need to anything special
for EnumCaseDecl except consuming them.
2021-09-03 16:45:24 -07:00
swift-ci
048047ee97 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-24 09:13:39 -07:00
Xi Ge
d7f5dc4b28 ABIChecker: diagnose mangled name changes
Moving generic constraint from extension to its member or vice versa may change the mangled name
of the member without changing the generic signature, thus introducing ABI breakages. This change
teaches the ABI checker to diagnose USR (mangled name) changes to cover such cases.

rdar://78276290
2021-08-23 17:06:37 -07:00
swift-ci
13a25aa85b Merge remote-tracking branch 'origin/main' into rebranch 2021-08-20 09:13:20 -07:00
Xi Ge
35cb97b8ad ABIChecker: minor refactoring to move code to APIDigester lib. NFC 2021-08-19 22:27:14 -07:00
swift-ci
ea513883e4 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-19 19:34:03 -07:00
Xi Ge
3d8fcf20f3 ABIChecker: include import decls in the intermediate JSON file
Removing an import statement can be potentially source-breaking. We should
prepare for diagnosing such case.
2021-08-18 15:55:00 -07:00
swift-ci
26238d5780 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-10 14:53:23 -07:00
Xi Ge
ed13a2f0e4 ABI checker: require explicit @available attributes for new APIs
Before this change, the ABI checker didn't complain about missing @available
attributes on new APIs if the enclosing scopes of new APIs have
availability information. Instead, we should require explicit @available attributes
for new APIs to prevent them inheriting wrong availability information from a
preexisting scope.

rdar://81719628
2021-08-10 11:24:08 -07:00
swift-ci
ecd2566295 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-29 05:53:06 -07:00
Hamish Knight
df566e3147 [AST] Rename decomposeInput/composeInput
Explicitly call out the fact we're dealing with
tuples.
2021-07-28 23:14:45 +01:00
Evan Wilde
0aafd09835 F_None was renamed OF_None
This patch updates usages of F_None to OF_None, as LLVM changed that in
commit 3302af9d4c39642bebe64dd60a3aa162fefc44b2.
2021-06-23 10:36:39 -07:00
Owen Voorhees
77efd77d23 [APIDigester] Build the API digester as a frontend tool instead of a standalone executable 2021-03-10 19:30:10 -08:00