mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge branch 'main' into temp-branch
This commit is contained in:
@@ -574,6 +574,7 @@ static LinkageLimit getLinkageLimit(SILDeclRef constant) {
|
||||
case Kind::AsyncEntryPoint:
|
||||
llvm_unreachable("Already handled");
|
||||
}
|
||||
|
||||
return Limit::None;
|
||||
}
|
||||
|
||||
@@ -754,17 +755,17 @@ SILDeclRef SILDeclRef::getMainFileEntryPoint(FileUnit *file) {
|
||||
}
|
||||
|
||||
bool SILDeclRef::hasClosureExpr() const {
|
||||
return loc.is<AbstractClosureExpr *>()
|
||||
&& isa<ClosureExpr>(getAbstractClosureExpr());
|
||||
return isa<AbstractClosureExpr *>(loc) &&
|
||||
isa<ClosureExpr>(getAbstractClosureExpr());
|
||||
}
|
||||
|
||||
bool SILDeclRef::hasAutoClosureExpr() const {
|
||||
return loc.is<AbstractClosureExpr *>()
|
||||
&& isa<AutoClosureExpr>(getAbstractClosureExpr());
|
||||
return isa<AbstractClosureExpr *>(loc) &&
|
||||
isa<AutoClosureExpr>(getAbstractClosureExpr());
|
||||
}
|
||||
|
||||
bool SILDeclRef::hasFuncDecl() const {
|
||||
return loc.is<ValueDecl *>() && isa<FuncDecl>(getDecl());
|
||||
return isa<ValueDecl *>(loc) && isa<FuncDecl>(getDecl());
|
||||
}
|
||||
|
||||
ClosureExpr *SILDeclRef::getClosureExpr() const {
|
||||
@@ -889,6 +890,11 @@ SerializedKind_t SILDeclRef::getSerializedKind() const {
|
||||
ASSERT(ABIRoleInfo(d).providesAPI()
|
||||
&& "should not get serialization info from ABI-only decl");
|
||||
|
||||
// A declaration marked as "never emitted into client" will not have its SIL
|
||||
// serialized, ever.
|
||||
if (d->isNeverEmittedIntoClient())
|
||||
return IsNotSerialized;
|
||||
|
||||
// Default and property wrapper argument generators are serialized if the
|
||||
// containing declaration is public.
|
||||
if (isDefaultArgGenerator() || (isPropertyWrapperBackingInitializer() &&
|
||||
@@ -1087,11 +1093,35 @@ bool SILDeclRef::isBackDeployed() const {
|
||||
&& "should not get backDeployed from ABI-only decl");
|
||||
|
||||
if (auto afd = dyn_cast<AbstractFunctionDecl>(decl))
|
||||
return afd->isBackDeployed(getASTContext());
|
||||
return afd->isBackDeployed();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SILDeclRef::hasNonUniqueDefinition() const {
|
||||
if (auto decl = getDecl())
|
||||
return declHasNonUniqueDefinition(decl);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SILDeclRef::declHasNonUniqueDefinition(const ValueDecl *decl) {
|
||||
// This function only forces the issue in embedded.
|
||||
if (!decl->getASTContext().LangOpts.hasFeature(Feature::Embedded))
|
||||
return false;
|
||||
|
||||
// If the declaration is marked as @_neverEmitIntoClient, it has a unique
|
||||
// definition.
|
||||
if (decl->isNeverEmittedIntoClient())
|
||||
return false;
|
||||
|
||||
// If the declaration is not from the main module, treat its definition as
|
||||
// non-unique.
|
||||
auto module = decl->getModuleContext();
|
||||
auto &ctx = module->getASTContext();
|
||||
return module != ctx.MainModule && ctx.MainModule;
|
||||
}
|
||||
|
||||
bool SILDeclRef::isForeignToNativeThunk() const {
|
||||
// If this isn't a native entry-point, it's not a foreign-to-native thunk.
|
||||
if (isForeign)
|
||||
|
||||
Reference in New Issue
Block a user