mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[modules] Introduce Module::getTopLevelDecls() to get the local-in-module top-level decls.
getDisplayDecls() was introduced for ":print_module" and works slightly differently, e.g. it will return the decls from a shadowed clang module, since we want to display them. Swift SVN r7909
This commit is contained in:
@@ -348,6 +348,20 @@ void Module::lookupClassMember(AccessPathTy accessPath,
|
||||
return owner.lookupClassMember(this, accessPath, name, results);
|
||||
}
|
||||
|
||||
void Module::getTopLevelDecls(SmallVectorImpl<Decl*> &Results) {
|
||||
if (isa<BuiltinModule>(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto TU = dyn_cast<TranslationUnit>(this)) {
|
||||
Results.append(TU->Decls.begin(), TU->Decls.end());
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleLoader &Owner = cast<LoadedModule>(this)->getOwner();
|
||||
return Owner.getTopLevelDecls(this, Results);
|
||||
}
|
||||
|
||||
void Module::getDisplayDecls(SmallVectorImpl<Decl*> &results) {
|
||||
if (isa<BuiltinModule>(this)) {
|
||||
// FIXME: The Builtin module isn't usually visible, but it would be nice
|
||||
|
||||
Reference in New Issue
Block a user