mirror of
https://github.com/apple/swift.git
synced 2026-06-27 12:25:55 +02:00
Introduce the notion of an "effective" code generation model
The code generation model for a particular declaration or conformance can be defined explicitly with `@export(interface)`, `@export(implementation)`, or `@inlinable` (for declarations), indicating where the definition will occur. Embedded Swift also has some limitations on what can be emitted into IR. For example, a generic function cannot be `@export(interface)` because Embedded Swift does not support unspecialized generics. Compute the effective code generation model based on what was explicitly specified, the limitations of the model, and the default code generation model for the given module, which defaults to "inlinable" but can be made "implementation" by the DeferredCodeGen feature. Use the effective code generation model for IR- and SIL-level determinations of linkage and where to emit symbols. [WIP] Start computing and using the "effective" code generation model FIXUP linkage of the alias symbol
This commit is contained in:
@@ -1443,10 +1443,16 @@ bool IRGenerator::canEmitWitnessTableLazily(SILWitnessTable *wt) {
|
||||
// @export(interface) conformances, which have a unique strong definition
|
||||
// in the owning module.
|
||||
if (SIL.getASTContext().LangOpts.hasFeature(Feature::Embedded)) {
|
||||
if (auto *normal = dyn_cast<NormalProtocolConformance>(wt->getConformance()))
|
||||
if (auto model = normal->getExplicitCodeGenerationModel())
|
||||
if (*model == CodeGenerationModel::Interface)
|
||||
if (auto *normal = dyn_cast<NormalProtocolConformance>(wt->getConformance())) {
|
||||
switch (normal->getEffectiveCodeGenerationModel()) {
|
||||
case CodeGenerationModel::Interface:
|
||||
return false;
|
||||
case CodeGenerationModel::Implementation:
|
||||
case CodeGenerationModel::Inlinable:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user