Skip to content

Commit 102f9a3

Browse files
committed
[NFC] Add isKnownObjC param to RenamedDeclRequest
This will be used to break cycles in a future commit.
1 parent 6de808e commit 102f9a3

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6753,7 +6753,7 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
67536753
bool hasDynamicSelfResult() const;
67546754

67556755
/// The async function marked as the alternative to this function, if any.
6756-
AbstractFunctionDecl *getAsyncAlternative() const;
6756+
AbstractFunctionDecl *getAsyncAlternative(bool isKnownObjC = false) const;
67576757

67586758
/// If \p asyncAlternative is set, then compare its parameters to this
67596759
/// (presumed synchronous) function's parameters to find the index of the

include/swift/AST/TypeCheckRequests.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3441,7 +3441,8 @@ class ConditionalRequirementsRequest
34413441

34423442
class RenamedDeclRequest
34433443
: public SimpleRequest<RenamedDeclRequest,
3444-
ValueDecl *(const ValueDecl *, const AvailableAttr *),
3444+
ValueDecl *(const ValueDecl *, const AvailableAttr *,
3445+
bool isKnownObjC),
34453446
RequestFlags::Cached> {
34463447
public:
34473448
using SimpleRequest::SimpleRequest;
@@ -3450,7 +3451,7 @@ class RenamedDeclRequest
34503451
friend SimpleRequest;
34513452

34523453
ValueDecl *evaluate(Evaluator &evaluator, const ValueDecl *attached,
3453-
const AvailableAttr *attr) const;
3454+
const AvailableAttr *attr, bool isKnownObjC) const;
34543455

34553456
public:
34563457
bool isCached() const { return true; }

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ SWIFT_REQUEST(TypeChecker, GetImplicitSendableRequest,
390390
ProtocolConformance *(NominalTypeDecl *),
391391
Cached, NoLocationInfo)
392392
SWIFT_REQUEST(TypeChecker, RenamedDeclRequest,
393-
ValueDecl *(const ValueDecl *),
393+
ValueDecl *(const ValueDecl *, const AvailableAttr *, bool),
394394
Cached, NoLocationInfo)
395395
SWIFT_REQUEST(TypeChecker, ClosureEffectsRequest,
396396
FunctionType::ExtInfo(ClosureExpr *),

lib/AST/Decl.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7627,7 +7627,8 @@ bool AbstractFunctionDecl::hasDynamicSelfResult() const {
76277627
return isa<ConstructorDecl>(this);
76287628
}
76297629

7630-
AbstractFunctionDecl *AbstractFunctionDecl::getAsyncAlternative() const {
7630+
AbstractFunctionDecl *
7631+
AbstractFunctionDecl::getAsyncAlternative(bool isKnownObjC) const {
76317632
// Async functions can't have async alternatives
76327633
if (hasAsync())
76337634
return nullptr;
@@ -7651,7 +7652,8 @@ AbstractFunctionDecl *AbstractFunctionDecl::getAsyncAlternative() const {
76517652
}
76527653

76537654
auto *renamedDecl = evaluateOrDefault(
7654-
getASTContext().evaluator, RenamedDeclRequest{this, avAttr}, nullptr);
7655+
getASTContext().evaluator, RenamedDeclRequest{this, avAttr, isKnownObjC},
7656+
nullptr);
76557657
auto *alternative = dyn_cast_or_null<AbstractFunctionDecl>(renamedDecl);
76567658
if (!alternative || !alternative->hasAsync())
76577659
return nullptr;

lib/PrintAsClang/DeclAndTypePrinter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,8 @@ class DeclAndTypePrinter::Implementation
11241124
assert(!AvAttr->Rename.empty());
11251125

11261126
auto *renamedDecl = evaluateOrDefault(
1127-
getASTContext().evaluator, RenamedDeclRequest{D, AvAttr}, nullptr);
1127+
getASTContext().evaluator, RenamedDeclRequest{D, AvAttr, false},
1128+
nullptr);
11281129
if (renamedDecl) {
11291130
assert(shouldInclude(renamedDecl) &&
11301131
"ObjC printer logic mismatch with renamed decl");

lib/Sema/TypeCheckAttr.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6218,7 +6218,8 @@ static bool parametersMatch(const AbstractFunctionDecl *a,
62186218

62196219
ValueDecl *RenamedDeclRequest::evaluate(Evaluator &evaluator,
62206220
const ValueDecl *attached,
6221-
const AvailableAttr *attr) const {
6221+
const AvailableAttr *attr,
6222+
bool isKnownObjC) const {
62226223
if (!attached || !attr)
62236224
return nullptr;
62246225

@@ -6249,7 +6250,7 @@ ValueDecl *RenamedDeclRequest::evaluate(Evaluator &evaluator,
62496250
auto minAccess = AccessLevel::Private;
62506251
if (attached->getModuleContext()->isExternallyConsumed())
62516252
minAccess = AccessLevel::Public;
6252-
bool attachedIsObjcVisible =
6253+
bool attachedIsObjcVisible = isKnownObjC ||
62536254
objc_translation::isVisibleToObjC(attached, minAccess);
62546255

62556256
SmallVector<ValueDecl *, 4> lookupResults;

0 commit comments

Comments
 (0)