[ModuleInterface] Don't print access on extensions

This ends up meaning "don't print access attributes, then print access
uniformly on ValueDecls if you're not printing access attributes".
This commit is contained in:
Jordan Rose
2018-08-07 17:23:40 -07:00
parent ec9d114bcb
commit 6526f11400
2 changed files with 7 additions and 4 deletions

View File

@@ -90,6 +90,8 @@ PrintOptions PrintOptions::printTextualInterfaceFile() {
// the default to 'public' and mark the 'internal' things.
result.PrintAccess = true;
result.ExcludeAttrList.push_back(DAK_AccessControl);
// FIXME: We'll need the actual default parameter expression.
result.PrintDefaultParameterPlaceholder = false;
@@ -493,8 +495,10 @@ class PrintAST : public ASTVisitor<PrintAST> {
}
void printAccess(const ValueDecl *D) {
if (!Options.PrintAccess || !D->hasAccess() ||
D->getAttrs().hasAttribute<AccessControlAttr>())
if (!Options.PrintAccess || !D->hasAccess())
return;
if (D->getAttrs().hasAttribute<AccessControlAttr>() &&
!llvm::is_contained(Options.ExcludeAttrList, DAK_AccessControl))
return;
printAccess(D->getFormalAccess());

View File

@@ -60,8 +60,7 @@ extension PublicProto {
@usableFromInline internal func ufiMethod() {}
} // CHECK: {{^[}]$}}
// FIXME: We shouldn't print access on extensions in textual interface files.
// CHECK: {{^}}public extension PublicProto {{[{]$}}
// CHECK: {{^}}extension PublicProto {{[{]$}}
public extension PublicProto {
// CHECK: public func publicExtPublicMethod(){{$}}
func publicExtPublicMethod() {}