[swift-api-digester] Ensure we exclude decls of low accessibility from the API comparison. (#5382)

This commit is contained in:
Xi Ge
2016-10-20 12:02:37 -07:00
committed by GitHub
parent 85343bea21
commit 87d22acb67
4 changed files with 61 additions and 1419 deletions

View File

@@ -1,4 +1,11 @@
public struct S1 { public struct S1 {
public func foo1() {} public func foo1() {}
mutating public func foo2() {} mutating public func foo2() {}
internal func foo3() {}
private func foo4() {}
fileprivate func foo5() {}
}
public class C1 {
open func foo1() {}
} }

View File

@@ -62,6 +62,49 @@
] ]
} }
] ]
},
{
"kind": "TypeDecl",
"name": "C1",
"printedName": "C1",
"declKind": "Class",
"usr": "s:C4cake2C1",
"location": "",
"moduleName": "cake",
"children": [
{
"kind": "Function",
"name": "foo1",
"printedName": "foo1()",
"declKind": "Func",
"usr": "s:FC4cake2C14foo1FT_T_",
"location": "",
"moduleName": "cake",
"children": [
{
"kind": "TypeNominal",
"name": "Void",
"printedName": "()"
}
]
},
{
"kind": "Constructor",
"name": "init",
"printedName": "init()",
"declKind": "Constructor",
"usr": "s:FC4cake2C1cFT_S0_",
"location": "",
"moduleName": "cake",
"children": [
{
"kind": "TypeNominal",
"name": "C1",
"printedName": "C1"
}
]
}
]
} }
] ]
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1112,6 +1112,15 @@ static bool shouldIgnore(Decl *D) {
return true; return true;
if (VD->getName().empty()) if (VD->getName().empty())
return true; return true;
switch (VD->getFormalAccess()) {
case Accessibility::Internal:
case Accessibility::Private:
case Accessibility::FilePrivate:
return true;
case Accessibility::Public:
case Accessibility::Open:
break;
}
} }
if (auto *ClangD = D->getClangDecl()) { if (auto *ClangD = D->getClangDecl()) {