When metadata record for a generic type is locally cached as ::Complete,
the metadata is known to be complete in that scope. If it's for a
generic type, being complete means that all of its recursive generic
arguments are also complete.
Previously, though, that fact was not exploited. So a metadata record
for such an argument which was originally obtained via an incomplete
request would remain cached in that incomplete state even when a generic
type in which it appeared as a generic argument was cached as complete.
At worst, the result was a runtime call (checkMetadataState) to promote
the complete the metadata record for the recursive argument.
Here, when a bound generic type's metadata is locally cached as
complete, its recursive generic arguments are visited; for each such
type for which a metadata record is already locally cached, the
preexisting record is recached as complete.
When building complex projects, there may cases of static libraries
which expose `@inlinable` functions which reference functions from
dynamically linked dependencies. In such a case, we need to consider the
provenance of the `function_ref` when determining the DLL storage for
linkage. We would previously use the deserialised metadata on the
`SILFunction` as there are entities where the `DeclContext` may not be
deserialised. However, this leaves us in a state where we are unable to
determine the actual provenance correctly in some cases. By simply
accessing the parent module directly from the `SILFunction` we ensure
that we properly identify the origin of the function allowing us to
query the DLL storage property. This further allows us to remove the
extra storage required for whether the `SILFunction` is statically
linked.
Swift methods can be called from Objective-C without a vtable
load, and more importantly without emitting an `llvm.type.checked.load`
instruction. These are effectively virtual callsites that are not
visible to the VFE logic in GlobalDCE.
To to safely enable swift-vfe we must prevent vtables whose functions
are callable from Objective-C from being eliminated.
To do this we ensure such vtables have public vcall_visibility, which
indirectly prevents GlobalDCE from stripping them.
The Swift and LLVM function mergers were disabled when Swift VFE or WME
are enabled because the function merger did not respect metadata on
calls to `llvm.type.checked.load`. This is no longer the case,
so we can turn these passes back on.
This type will become the corresponding type that is resolved for an
`InverseTypeRepr`. This kind of type is not expected to appear past type
checking (currently, not even past requirement lowering!).
Conflicts:
- `lib/AST/TypeCheckRequests.cpp` renamed `isMoveOnly` which requires
a static_cast on rebranch because `Optional` is now a `std::optional`.
The assert was wrong because in case a global variable reference another global variable, it can be the case that the other variable is first generated as declaration and then "converted" to a definition by adding the constant initializer.
rdar://117189962
I've renamed the method to `TypeDecl::isNoncopyable`, because the query
doesn't make sense for many other kinds of `ValueDecl`'s beyond the
`TypeDecl`'s. In fact, it looks like no one was relying on that anyway.
Thus, we now have a distinction where in Sema, you ask whether
a `Type` or `TypeDecl` is "Noncopyable". But within SIL, we still
preserve the notion of "move-only" since there is additionally the
move-only type wrapper for types that otherwise support copying.
This attribute instructs the compiler that this function declaration
should be "import"ed from host environment. It's equivalent of Clang's
`__attribute__((import_module("module"), import_name("field")))`