Excise "Accessibility" from the compiler (3/3)

"Accessibility" has a different meaning for app developers, so we've
already deliberately excised it from our diagnostics in favor of terms
like "access control" and "access level". Do the same in the compiler
now that we aren't constantly pulling things into the release branch.

Rename AccessibilityAttr to AccessControlAttr and
SetterAccessibilityAttr to SetterAccessAttr, then track down the last
few uses of "accessibility" that don't have to do with
NSAccessibility. (I left the SourceKit XPC API alone because that's
supposed to be more stable.)
This commit is contained in:
Jordan Rose
2017-08-28 13:27:59 -07:00
parent 1c651973c3
commit 449cd98997
44 changed files with 209 additions and 210 deletions

View File

@@ -910,15 +910,15 @@ static UIdent getAccessLevelUID(AccessLevel Access) {
return AccessOpen;
}
llvm_unreachable("Unhandled Accessibility in switch.");
llvm_unreachable("Unhandled access level in switch.");
}
static Optional<AccessLevel> getAccessLevelStrictly(const ExtensionDecl *ED) {
if (ED->hasDefaultAccessLevel())
return ED->getDefaultAccessLevel();
// Check if the decl has an explicit accessibility attribute.
if (auto *AA = ED->getAttrs().getAttribute<AccessibilityAttr>())
// Check if the decl has an explicit access control attribute.
if (auto *AA = ED->getAttrs().getAttribute<AccessControlAttr>())
return AA->getAccess();
return None;
@@ -932,16 +932,16 @@ static AccessLevel inferDefaultAccessLevel(const ExtensionDecl *ED) {
return AccessLevel::Internal;
}
/// If typechecking was performed we use the computed accessibility, otherwise
/// we fallback to inferring accessibility syntactically. This may not be as
/// If typechecking was performed we use the computed access level, otherwise
/// we fallback to inferring access syntactically. This may not be as
/// accurate but it's only until we have typechecked the AST.
static AccessLevel inferAccessLevel(const ValueDecl *D) {
assert(D);
if (D->hasAccess())
return D->getFormalAccess();
// Check if the decl has an explicit accessibility attribute.
if (auto *AA = D->getAttrs().getAttribute<AccessibilityAttr>())
// Check if the decl has an explicit access control attribute.
if (auto *AA = D->getAttrs().getAttribute<AccessControlAttr>())
return AA->getAccess();
DeclContext *DC = D->getDeclContext();
@@ -982,7 +982,7 @@ inferSetterAccessLevel(const AbstractStorageDecl *D) {
// FIXME: Have the parser detect as read-only the syntactic form of generated
// interfaces, which is "var foo : Int { get }"
if (auto *AA = D->getAttrs().getAttribute<SetterAccessibilityAttr>())
if (auto *AA = D->getAttrs().getAttribute<SetterAccessAttr>())
return AA->getAccess();
else
return inferAccessLevel(D);