Skip to content

Commit 23d9def

Browse files
committed
[AST] Set import access level to internal when invalid
1 parent 859dabd commit 23d9def

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/AST/Decl.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,11 @@ ArrayRef<ValueDecl *> ImportDecl::getDecls() const {
14811481

14821482
AccessLevel ImportDecl::getAccessLevel() const {
14831483
if (auto attr = getAttrs().getAttribute<AccessControlAttr>()) {
1484-
return attr->getAccess();
1484+
if (attr->getAccess() == AccessLevel::Open) {
1485+
// Use a conservative import if the level given is invalid.
1486+
return AccessLevel::Internal;
1487+
} else
1488+
return attr->getAccess();
14851489
}
14861490

14871491
auto &LangOpts = getASTContext().LangOpts;

0 commit comments

Comments
 (0)