mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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());
|
||||
|
||||
@@ -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() {}
|
||||
|
||||
Reference in New Issue
Block a user