Skip to content

Commit cfd1fdb

Browse files
committed
[Sema] Clean up remaining uses of FromSPI
1 parent efc4e7d commit cfd1fdb

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

lib/Sema/TypeCheckAccess.cpp

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ enum class DowngradeToWarning: bool {
4242
Yes
4343
};
4444

45-
/// A uniquely-typed boolean to reduce the chances of accidentally inverting
46-
/// a check.
47-
///
48-
/// \see checkTypeAccessImpl
49-
enum class FromSPI: bool {
50-
No,
51-
Yes
52-
};
53-
5445
/// Calls \p callback for each type in each requirement provided by
5546
/// \p source.
5647
static void forAllRequirementTypes(
@@ -87,7 +78,7 @@ class AccessControlCheckerBase {
8778

8879
void checkTypeAccessImpl(
8980
Type type, TypeRepr *typeRepr, AccessScope contextAccessScope,
90-
const DeclContext *useDC, bool mayBeInferred, FromSPI fromSPI,
81+
const DeclContext *useDC, bool mayBeInferred,
9182
llvm::function_ref<CheckTypeAccessCallback> diagnose);
9283

9384
void checkTypeAccess(
@@ -109,7 +100,7 @@ class AccessControlCheckerBase {
109100
llvm::function_ref<CheckTypeAccessCallback> diagnose) {
110101
forAllRequirementTypes(std::move(source), [&](Type type, TypeRepr *typeRepr) {
111102
checkTypeAccessImpl(type, typeRepr, accessScope, useDC,
112-
/*mayBeInferred*/false, FromSPI::No, diagnose);
103+
/*mayBeInferred*/false, diagnose);
113104
});
114105
}
115106

@@ -196,12 +187,9 @@ class TypeAccessScopeDiagnoser : private ASTWalker {
196187
/// using `Array` to mean `Array<Element>` in an extension of Array.) If
197188
/// \p typeRepr is known to be absent, it's okay to pass \c false for
198189
/// \p mayBeInferred.
199-
///
200-
/// If searching from an SPI context, pass \c FromSPI::YES for \p fromSPI.
201-
/// In this mode, all types must be public and diagnostic messages are adapted.
202190
void AccessControlCheckerBase::checkTypeAccessImpl(
203191
Type type, TypeRepr *typeRepr, AccessScope contextAccessScope,
204-
const DeclContext *useDC, bool mayBeInferred, FromSPI fromSPI,
192+
const DeclContext *useDC, bool mayBeInferred,
205193
llvm::function_ref<CheckTypeAccessCallback> diagnose) {
206194

207195
auto &Context = useDC->getASTContext();
@@ -310,9 +298,8 @@ void AccessControlCheckerBase::checkTypeAccess(
310298
context->getFormalAccessScope(
311299
context->getDeclContext(), checkUsableFromInline);
312300

313-
auto fromSPI = static_cast<FromSPI>(context->isSPI());
314301
checkTypeAccessImpl(type, typeRepr, contextAccessScope, DC, mayBeInferred,
315-
fromSPI, diagnose);
302+
diagnose);
316303
}
317304

318305
/// Highlights the given TypeRepr, and adds a note pointing to the type's
@@ -372,10 +359,6 @@ void AccessControlCheckerBase::checkGenericParamAccess(
372359
};
373360

374361
auto *DC = ownerDecl->getDeclContext();
375-
auto fromSPI = FromSPI::No;
376-
if (auto ownerValueDecl = dyn_cast<ValueDecl>(ownerDecl)) {
377-
fromSPI = static_cast<FromSPI>(ownerValueDecl->isSPI());
378-
}
379362

380363
for (auto param : *params) {
381364
if (param->getInherited().empty())
@@ -384,7 +367,7 @@ void AccessControlCheckerBase::checkGenericParamAccess(
384367
checkTypeAccessImpl(param->getInherited().front().getType(),
385368
param->getInherited().front().getTypeRepr(),
386369
accessScope, DC, /*mayBeInferred*/false,
387-
fromSPI, callback);
370+
callback);
388371
}
389372
callbackACEK = ACEK::Requirement;
390373

@@ -1496,7 +1479,7 @@ class ExportabilityChecker : public DeclVisitor<ExportabilityChecker> {
14961479
bool foundAnyIssues = false;
14971480

14981481
// Check the TypeRepr first (if present), because that will give us a
1499-
// better diagonstic.
1482+
// better diagnostic.
15001483
if (typeRepr) {
15011484
const_cast<TypeRepr *>(typeRepr)->walk(TypeReprIdentFinder(
15021485
[&](const ComponentIdentTypeRepr *component) {

0 commit comments

Comments
 (0)