Skip to content

Commit 8ab0f51

Browse files
authored
Merge pull request swiftlang#32262 from martinboehme/replace-ishidden
Replace clang::Decl::isHidden() with clang::Sema::isVisible()
2 parents 80a5fb2 + fc1cf3b commit 8ab0f51

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2904,11 +2904,12 @@ void ClangModuleUnit::lookupValue(DeclName name, NLKind lookupKind,
29042904
bool ClangImporter::Implementation::isVisibleClangEntry(
29052905
const clang::NamedDecl *clangDecl) {
29062906
// For a declaration, check whether the declaration is hidden.
2907-
if (!clangDecl->isHidden()) return true;
2907+
clang::Sema &clangSema = getClangSema();
2908+
if (clangSema.isVisible(clangDecl)) return true;
29082909

29092910
// Is any redeclaration visible?
29102911
for (auto redecl : clangDecl->redecls()) {
2911-
if (!cast<clang::NamedDecl>(redecl)->isHidden()) return true;
2912+
if (clangSema.isVisible(cast<clang::NamedDecl>(redecl))) return true;
29122913
}
29132914

29142915
return false;
@@ -3019,8 +3020,10 @@ void ClangImporter::loadExtensions(NominalTypeDecl *nominal,
30193020
SmallVector<clang::NamedDecl *, 4> DelayedCategories;
30203021

30213022
// Simply importing the categories adds them to the list of extensions.
3022-
for (const auto *Cat : objcClass->visible_categories()) {
3023-
Impl.importDeclReal(Cat, Impl.CurrentVersion);
3023+
for (const auto *Cat : objcClass->known_categories()) {
3024+
if (getClangSema().isVisible(Cat)) {
3025+
Impl.importDeclReal(Cat, Impl.CurrentVersion);
3026+
}
30243027
}
30253028
}
30263029

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7097,9 +7097,12 @@ void SwiftDeclConverter::importMirroredProtocolMembers(
70977097
return;
70987098

70997099
bool inNearbyCategory =
7100-
std::any_of(interfaceDecl->visible_categories_begin(),
7101-
interfaceDecl->visible_categories_end(),
7100+
std::any_of(interfaceDecl->known_categories_begin(),
7101+
interfaceDecl->known_categories_end(),
71027102
[=](const clang::ObjCCategoryDecl *category) -> bool {
7103+
if (!Impl.getClangSema().isVisible(category)) {
7104+
return false;
7105+
}
71037106
if (category != decl) {
71047107
auto *categoryModule =
71057108
Impl.getClangModuleForDecl(category);

0 commit comments

Comments
 (0)