Skip to content

Commit c72b127

Browse files
committed
[NFC] Sema: Extract static function.
In preparation for a recursive call and an additional private parameter.
1 parent d298602 commit c72b127

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/Sema/TypeCheckStorage.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,24 +2670,25 @@ RequiresOpaqueAccessorsRequest::evaluate(Evaluator &evaluator,
26702670
///
26712671
/// The underscored accessor could, however, still be required for ABI
26722672
/// stability.
2673-
bool AbstractStorageDecl::requiresCorrespondingUnderscoredCoroutineAccessor(
2674-
AccessorKind kind, AccessorDecl const *decl) const {
2675-
auto &ctx = getASTContext();
2673+
static bool requiresCorrespondingUnderscoredCoroutineAccessorImpl(
2674+
AbstractStorageDecl const *storage, AccessorKind kind,
2675+
AccessorDecl const *decl) {
2676+
auto &ctx = storage->getASTContext();
26762677
assert(ctx.LangOpts.hasFeature(Feature::CoroutineAccessors));
26772678
assert(kind == AccessorKind::Modify2 || kind == AccessorKind::Read2);
26782679

26792680
// Non-stable modules have no ABI to keep stable.
2680-
if (getModuleContext()->getResilienceStrategy() !=
2681+
if (storage->getModuleContext()->getResilienceStrategy() !=
26812682
ResilienceStrategy::Resilient)
26822683
return false;
26832684

26842685
// Non-exported storage has no ABI to keep stable.
2685-
if (!isExported(this))
2686+
if (!isExported(storage))
26862687
return false;
26872688

26882689
// The non-underscored accessor is not present, the underscored accessor
26892690
// won't be either.
2690-
auto *accessor = decl ? decl : getOpaqueAccessor(kind);
2691+
auto *accessor = decl ? decl : storage->getOpaqueAccessor(kind);
26912692
if (!accessor)
26922693
return false;
26932694

@@ -2709,6 +2710,12 @@ bool AbstractStorageDecl::requiresCorrespondingUnderscoredCoroutineAccessor(
27092710
return true;
27102711
}
27112712

2713+
bool AbstractStorageDecl::requiresCorrespondingUnderscoredCoroutineAccessor(
2714+
AccessorKind kind, AccessorDecl const *decl) const {
2715+
return requiresCorrespondingUnderscoredCoroutineAccessorImpl(this, kind,
2716+
decl);
2717+
}
2718+
27122719
bool RequiresOpaqueModifyCoroutineRequest::evaluate(
27132720
Evaluator &evaluator, AbstractStorageDecl *storage,
27142721
bool isUnderscored) const {

0 commit comments

Comments
 (0)