Commit Graph

39 Commits

Author SHA1 Message Date
Ian Anderson
5cdf2a879a [ABIChecker] Remove -iframework from swift-api-digester
-iframework is a holdover from when swift-api-digester was an LLVM tool. Now that everything has switched over to -Fsystem, -iframework can be removed.

rdar://153665579
2025-11-12 16:37:49 -08:00
Xi Ge
5c530ea4e4 ABI checker: drop usage of AllowDeserializingImplementationOnly
AllowDeserializingImplementationOnly was historically added as a defensive
check against deserailzation issues introduced by @implementationOnly imports.
It's no longer specified by other tools, thus the ABI checker should drop
it as well.

rdar://153683760
2025-06-25 12:15:21 -07:00
Anthony Latsis
1ceeb7089b Merge pull request #82338 from AnthonyLatsis/jepa
ASTBridging: Bridge more enums directly
2025-06-20 23:13:50 +01:00
Ian Anderson
cb954b98f9 [ABIChecker] Use -Isystem and -Fsystem for swift-api-digester
Use the Swift -Fsystem flag for swift-api-digester instead of the clang -iframework flag. Add support for -Isystem for parity.

rdar://152747420
2025-06-18 21:21:45 -07:00
Anthony Latsis
3e9923f0c0 ASTBridging: Bridge swift::AccessorKind directly 2025-06-19 04:26:52 +01:00
Ian Anderson
87d6979dae Merge pull request #78303 from ian-twilightcoder/clang-importer-search-paths
[ClangImporter] clang's -iframework comes before builtin usr/local/include, but Swift's -Fsystem comes after
2025-01-06 13:05:25 -08:00
Xi Ge
0f98e5803a Frontend: add an ABI checker flag to avoid downgrading detected ABI breakages into warnings. rdar://122325279 2025-01-02 16:41:03 -08:00
Ian Anderson
cdb42c3535 [ClangImporter] clang's -iframework comes before builtin usr/local/include, but Swift's -Fsystem comes after
When Swift passes search paths to clang, it does so directly into the HeaderSearch. That means that those paths get ordered inconsistently compared to the equivalent clang flag, and causes inconsistencies when building clang modules with clang and with Swift. Instead of touching the HeaderSearch directly, pass Swift search paths as driver flags, just do them after the -Xcc ones.

Swift doesn't have a way to pass a search path to clang as -isystem, only as -I which usually isn't the right flag. Add an -Isystem Swift flag so that those paths can be passed to clang as -isystem.

rdar://93951328
2024-12-23 22:15:52 -08:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Ben Barham
1fdda023b3 Rename StringRef::endswith references to StringRef::ends_with
Missed this when doing the `startswith` renaming. `endswith` has also
been deprecated upstream (and presumably soon to be removed).
2024-04-01 10:59:16 -07:00
Ben Barham
9779c18da3 Rename startswith to starts_with
LLVM is presumably moving towards `std::string_view` -
`StringRef::startswith` is deprecated on tip. `SmallString::startswith`
was just renamed there (maybe with some small deprecation inbetween, but
if so, we've missed it).

The `SmallString::startswith` references were moved to
`.str().starts_with()`, rather than adding the `starts_with` on
`stable/20230725` as we only had a few of them. Open to switching that
over if anyone feels strongly though.
2024-03-13 22:25:47 -07:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Rintaro Ishizaki
b839718351 [AST] Use scoped enum for attribute kinds
Align with other kind enum e.g. DeclKind.
2024-02-02 09:36:48 -08:00
Evan Wilde
250082df25 [NFC] Reformat all the LLVMs
Reformatting everything now that we have `llvm` namespaces. I've
separated this from the main commit to help manage merge-conflicts and
for making it a bit easier to read the mega-patch.
2023-06-27 09:03:52 -07:00
Evan Wilde
f3ff561c6f [NFC] add llvm namespace to Optional and None
This is phase-1 of switching from llvm::Optional to std::optional in the
next rebranch. llvm::Optional was removed from upstream LLVM, so we need
to migrate off rather soon. On Darwin, std::optional, and llvm::Optional
have the same layout, so we don't need to be as concerned about ABI
beyond the name mangling. `llvm::Optional` is only returned from one
function in
```
getStandardTypeSubst(StringRef TypeName,
                     bool allowConcurrencyManglings);
```
It's the return value, so it should not impact the mangling of the
function, and the layout is the same as `std::optional`, so it should be
mostly okay. This function doesn't appear to have users, and the ABI was
already broken 2 years ago for concurrency and no one seemed to notice
so this should be "okay".

I'm doing the migration incrementally so that folks working on main can
cherry-pick back to the release/5.9 branch. Once 5.9 is done and locked
away, then we can go through and finish the replacement. Since `None`
and `Optional` show up in contexts where they are not `llvm::None` and
`llvm::Optional`, I'm preparing the work now by going through and
removing the namespace unwrapping and making the `llvm` namespace
explicit. This should make it fairly mechanical to go through and
replace llvm::Optional with std::optional, and llvm::None with
std::nullopt. It's also a change that can be brought onto the
release/5.9 with minimal impact. This should be an NFC change.
2023-06-27 09:03:52 -07:00
Steven Wu
09b8af86fb Virtualize swift compiler outputs (#63206)
Using a virutal output backend to capture all the outputs from
swift-frontend invocation. This allows redirecting and/or mirroring
compiler outputs to multiple location using different OutputBackend.

As an example usage for the virtual outputs, teach swift compiler to
check its output determinism by running the compiler invocation
twice and compare the hash of all its outputs.

Virtual output will be used to enable caching in the future.
2023-04-05 23:34:37 +08:00
Xi Ge
42ffbe4787 ABIChecker: add an internal setting for downgrading ABI breakages to warnings 2023-03-18 20:10:58 -07:00
Xi Ge
8d6774eafb ABI checker: add a flag to opt-in diagnosing deprecated symbols
rdar://105255151
2023-02-17 13:58:33 -08:00
Xi Ge
ba3cc288b6 ABI Checker: avoid reporting module importation changes
ABI changes due to imported module changes should be reflected by other symbol changes. Reporting
module import changes seems to be redundant.
2023-02-09 15:15:50 -08:00
Doug Gregor
8871129896 [Macros] Add frontend flag to dump macro expansions for diagnostics.
Add frontend flag `-emit-macro-expansion-files diagnostics` to emit any
macro expansion buffers referenced by diagnostics into files in a
temporary directory. This makes debugging type-checking failures in
macro expansions far easier, because you can see them after the
compiler process has exited.
2023-01-30 18:05:53 -08:00
Xi Ge
3b189a5f10 ABIChecker: avoid diagnosing SwiftOnoneSupport being renamed
Dropping dependency on SwiftOnoneSupport is typically not an ABI-breaking change.

rdar://104567396
2023-01-23 21:39:09 -08:00
Doug Gregor
76e0d5e726 [Macro] API digester support for macro declarations 2023-01-02 21:22:05 -08:00
Erik Eckstein
ab1b343dad use new llvm::Optional API
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
2022-11-21 19:44:24 +01:00
Robert Widmann
18b79ffcfd Resolve a Layering Violation in libBasic
Basic should not be allowed to link Parse, yet it was doing so
to allow Version to provide a constructor that would conveniently
parse a StringRef. This entrypoint also emitted diagnostics, so it
pulled in libAST.

Sink the version parser entrypoint down into Parse where it belongs
and point all the clients to the right place.
2022-09-09 00:21:30 -07:00
Xi Ge
9ea86830ff ABI checker: we should also print ABI breakages when diagnostics are serialized
This ensures users can review ABI checker failures from build logs alone.

rdar://98624267
2022-08-29 13:26:17 -07:00
Xi Ge
3b522c747d ABIChecker: removing the importation of SwiftOnoneSupport shouldn't be flagged as breakage
SwiftOnoneSupport is automatically imported in the debug mode. When diffing the release build with
a baseline genearted in the debug build, we may hit this false positive.
2022-08-15 12:00:48 -07:00
Xi Ge
227c2ba9a1 ABI checker: adding protocol requirement with default implementation should not be flagged as breakage
rdar://98583968
2022-08-15 11:47:33 -07:00
Xi Ge
2fba124779 ABIChecker: diagnose removal of deprecated symbols by default
rdar://95385661
2022-06-17 10:37:28 -07:00
Xi Ge
dfb53212d8 ABIChecker: add an option to avoid diagnosing about certain given SPI groups
rdar://92032848
2022-06-04 22:28:37 -07:00
Josh Soref
66d267e6ff Spelling driver (#42516)
* spelling: associated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: change

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declaration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependents

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deterministically

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: embedded

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: exclude

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: filesystem

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: given

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: grained

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: incrementality

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: invoke

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: locals

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: preexisting

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: should

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: supplementary

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: suppress

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-22 09:10:43 -07: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
Xi Ge
819e53e94f ABI checker: removing deprecated APIs should be considered acceptable 2021-10-20 13:16:52 -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
97cfa6b6f8 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-13 13:52:43 -07:00
Xi Ge
515cf21ba3 driver: refactor driver tool logics into a library. NFC 2021-07-13 10:03:12 -07:00