mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Macros] Improve visitation of auxiliary decls
Use the same pattern as 'getAllMembers()'. This supports nested macro
expansion:
```
std::function<void(Decl *)> visit;
visit = [&](Decl *d) {
doIt(d);
d->visitAuxiliaryDecls(visit);
};
for (auto *d : decls)
visit(d);
```
Don't visit auxiliary decls in `PrintAST::visit(Decl *)` this function
is only intended for single decl printing. The caller should visit them
separately. For that, add
`ModuleDecl::getTopLevelDeclsWithAuxiliaryDecls()`
This commit is contained in:
@@ -833,7 +833,7 @@ bool swift::emitSwiftInterface(raw_ostream &out,
|
||||
InheritedProtocolCollector::PerTypeMap inheritedProtocolMap;
|
||||
|
||||
SmallVector<Decl *, 16> topLevelDecls;
|
||||
M->getTopLevelDecls(topLevelDecls);
|
||||
M->getTopLevelDeclsWithAuxiliaryDecls(topLevelDecls);
|
||||
for (const Decl *D : topLevelDecls) {
|
||||
InheritedProtocolCollector::collectProtocols(inheritedProtocolMap, D);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user