Skip to content

Commit 91a4869

Browse files
committed
Make isVisibleFromModule accept TagDecl definitions that were demoted to declarations.
Clang AST requires to have only a single definition in a redeclaration chain, that's why it demotes duplicate definitions from other modules to declarations. But on the Swift side it is important to know a module contains a full definition and not just a forward declaration, even if it was demoted to a declaration.
1 parent cb27114 commit 91a4869

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,9 +2706,12 @@ static bool isVisibleFromModule(const ClangModuleUnit *ModuleFilter,
27062706

27072707
// For enums, structs, and unions, only count definitions when looking to
27082708
// see what other modules they appear in.
2709-
if (IsTagDecl)
2710-
if (!cast<clang::TagDecl>(Redeclaration)->isCompleteDefinition())
2709+
if (IsTagDecl) {
2710+
auto TD = cast<clang::TagDecl>(Redeclaration);
2711+
if (!TD->isCompleteDefinition() &&
2712+
!TD->isThisDeclarationADemotedDefinition())
27112713
continue;
2714+
}
27122715

27132716
auto OwningClangModule = getClangTopLevelOwningModule(Redeclaration,
27142717
ClangASTContext);

0 commit comments

Comments
 (0)