Don't visit synthesized extensions twice.

Teach `getTopLevelDeclsWithAuxiliaryDecls` not to provide extension
declarations, because those are covered by the synthesized file, which
all clients need to walk anyway. Without this, we end up asserting in
TBD generation about duplicate symbol visitation.

Encountered while investigating rdar://108056018.
This commit is contained in:
Doug Gregor
2023-04-19 10:51:55 -07:00
parent 1bf924d938
commit c155bc4cbe
2 changed files with 3 additions and 2 deletions

View File

@@ -4072,7 +4072,8 @@ void FileUnit::getTopLevelDeclsWithAuxiliaryDecls(
getTopLevelDecls(nonExpandedDecls);
for (auto *decl : nonExpandedDecls) {
decl->visitAuxiliaryDecls([&](Decl *auxDecl) {
results.push_back(auxDecl);
if (!isa<ExtensionDecl>(auxDecl))
results.push_back(auxDecl);
});
results.push_back(decl);
}