Skip to content

[rebranch] Manually merge main to rebranch #75727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Aug 6, 2024

Conversation

bnbarham
Copy link
Contributor

@bnbarham bnbarham commented Aug 6, 2024

Conflicts:

  • lib/PrintAsClang/PrintSwiftToClangCoreScaffold.cpp not positive what the cause here was, just took main.

tbkka and others added 30 commits August 1, 2024 09:15
This concrete implementation of the BuildConfiguration allows the use of
the SwiftIfConfig library's APIs where the build configuration comes from
the compiler itself.
The SwiftIfConfig library provides APIs for evaluating and extracting
the active #if regions in source code. Use its "configured regions" API
along with the ASTContext-backed build configuration to reimplement the
extraction of active/inactive regions from the source.

This approach has the benefit of being effectively stateless: where the
existing solution relies on the C++ parser recording all of the `#if`
clauses it sees as it is parsing (and then might have to sort them later),
this version does a scan of source to collect the list without requiring
any other state. The newer implementation is also conceptually cleaner,
and can be shared with other clients that have their own take on the
build configuration.

The primary client of this information is the SourceKit request that
identifies "inactive" regions within the source file, which IDEs can
use to grey out inactive code within the current build configuration.
There is also some profiling information that uses it. Those clients
should be unaffected by this under-the-hood change.

For the moment, I'm leaving the old code path in place for compiler
builds that don't have swift-syntax. This should be considered
temporary, and that code should be removed in favor of request'ifying
this function and removing the incrementally-built state entirely.
…SwiftIfConfig

The SIL coverage map generation depends on the locations of the `#endif`
directives, but the mapping from SwiftIfConfig's configured regions wasn't
producing them. The information is implicitly available in the
SwiftIfConfig configured regions, so reconstitute it as we translate
regions.
This implementation depends on ASTGen, which isn't linked as part of the
AST library.
…d is enabled

This warning is designed to be an early report of name conflicts in
swiftinterfaces caused by a type having the same name as a module.
Make sure we silence this warning when the workaround
-alias-module-names-in-module-interface is enabled. This is what we
already do for -module-interface-preserve-types-as-written.

rdar://132990400
We already maintain a stack of parent expressions
which is sufficient.
This is no longer needed now that we fold
SequenceExpr during the pre-walk.
We only need to consider the ExprPattern case
here, everything else should be skipped.
And use it for walking the SyntacticElementTarget
such that patterns for uninitialized vars are
walked too.
Use `preCheckTarget` to pre-check the body,
allowing us to replace `PreCheckResultBuilderRequest`
with a request that only checks the brace for
ReturnStmts.
…dConfiguration

Unlike all of the other build configuration checks, `canImport` has
side effects including the emission of various diagnostics. Thread a
source location through here so the diagnostics end up on the right
line.
Fixes:

    third_party/swift/include/swift/Demangling/Demangler.h:228:11:
      error: declaration of ‘swift::Demangle::NodeFactory::Slab* swift::Demangle::NodeFactory::Checkpoint::Slab’
             changes meaning of ‘Slab’ [-fpermissive]
      228 |     Slab *Slab;
          |           ^~~~
    third_party/swift/include/swift/Demangling/Demangler.h:47:10:
      note: ‘Slab’ declared here as ‘struct swift::Demangle::NodeFactory::Slab’
       47 |   struct Slab {
          |          ^~~~

No intended behavior change.
Embedded Swift has a minimal runtime, some type metadata is not
available. This patch works around a crash that tries to emit C++
briding to this non-existent Swift metadata. It is very likely that
there will be more fallout in reverse interop, but this patch should fix
the most glaring issue, crashing on an empty Embedded Swift project.

rdar://129030521
We don't have to take deinit effects into acount for a `destroy_value [dead_end]`.
Such destroys are lowered to no-ops and will not call any deinit.
Handle `apply` and `try_apply`.
Also, improve test cases
…s base

Makes e.g. alias analysis more precise in the early stage of the pass pipeline where addressor calls are not inlined, yet.
wording.

Splitting up the diagnostic into separate diagnostics based on the reference
kind is easier for me to read. The wording of the error message now puts
the problem -- crossing an isolation boundary -- at the center of the message,
and attempts to clarify how the value crosses an isolation boundary. E.g. for
the witness diagnostics, the value crosses an isolation boundary when calling
the witness through the protocol requirement in generic code.

This change does not add any additional information to the diagnostics, but it'd
be valuable to show both the source and destination isolation.
[cxx-interop] Fix crash with reverse interop in Embedded Swift
In anticipation of adding a new kind of missing import record to `SourceFile`,
clarify the purpose of the existing "missing imports" record with more specific
naming and documentation.
This will make it possible to use type checking APIs to determine the
appropriate access level for suggested imports.

NFC.
adrian-prantl and others added 8 commits August 5, 2024 21:32
Expose a ImportPrivateDependencies LangOpt for LLDB (NFC).
…ovements

Optimizer: some improvements for alias analysis in several utilities
[Sema] A couple of pre-checking cleanups
…-note

[Concurrency] Emit a better note when an isolated stored property initializer cannot be used.
…o-rebranch

Conflicts:
  - `lib/PrintAsClang/PrintSwiftToClangCoreScaffold.cpp` not positive
    what the cause here was, just took main.
@bnbarham bnbarham merged commit 60e41d6 into swiftlang:rebranch Aug 6, 2024
@bnbarham bnbarham deleted the manually-merge-main-to-rebranch branch August 6, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.