Skip to content

Commit 863b1a8

Browse files
authored
Merge pull request #70607 from apple/egorzhdan/ns-sourceloc-assert
[cxx-interop] Do not try to print empty namespaces in module interfaces
2 parents 1e17238 + 4a6bc77 commit 863b1a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/IDE/ModuleInterfacePrinting.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,10 +665,14 @@ void swift::ide::printModuleInterface(
665665
// An imported namespace decl will contain members from all redecls, so
666666
// make sure we add all the redecls.
667667
for (auto redecl : namespaceDecl->redecls()) {
668+
if (redecl->decls_empty())
669+
continue;
668670
// Namespace redecls may exist across mutliple modules. We want to
669671
// add the decl "D" to every module that has a redecl. But we only
670672
// want to add "D" once to prevent duplicate printing.
671673
clang::SourceLocation loc = redecl->getLocation();
674+
assert(loc.isValid() &&
675+
"expected a valid SourceLocation for a non-empty namespace");
672676
auto *owningModule = Importer.getClangOwningModule(redecl);
673677
auto found = ClangDecls.find(owningModule);
674678
if (found != ClangDecls.end() &&

0 commit comments

Comments
 (0)