@@ -949,30 +949,32 @@ SourceFile::getExternalRawLocsForDecl(const Decl *D) const {
949
949
return Result;
950
950
}
951
951
952
- void ModuleDecl::getDisplayDecls (SmallVectorImpl<Decl*> &Results) const {
953
- if (isParsedModule (this )) {
952
+ void ModuleDecl::getDisplayDecls (SmallVectorImpl<Decl*> &Results, bool Recursive ) const {
953
+ if (Recursive && isParsedModule (this )) {
954
954
SmallPtrSet<ModuleDecl *, 4 > Modules;
955
955
collectParsedExportedImports (this , Modules);
956
956
for (const ModuleDecl *import : Modules) {
957
- import ->getDisplayDecls (Results);
957
+ import ->getDisplayDecls (Results, Recursive );
958
958
}
959
959
}
960
960
// FIXME: Should this do extra access control filtering?
961
961
FORWARD (getDisplayDecls, (Results));
962
962
963
963
#ifndef NDEBUG
964
- llvm::DenseSet<Decl *> visited;
965
- for (auto *D : Results) {
966
- // decls synthesized from implicit clang decls may appear multiple times;
967
- // e.g. if multiple modules with underlying clang modules are re-exported.
968
- // including duplicates of these is harmless, so skip them when counting
969
- // this assertion
970
- if (const auto *CD = D->getClangDecl ()) {
971
- if (CD->isImplicit ()) continue ;
972
- }
964
+ if (Recursive) {
965
+ llvm::DenseSet<Decl *> visited;
966
+ for (auto *D : Results) {
967
+ // decls synthesized from implicit clang decls may appear multiple times;
968
+ // e.g. if multiple modules with underlying clang modules are re-exported.
969
+ // including duplicates of these is harmless, so skip them when counting
970
+ // this assertion
971
+ if (const auto *CD = D->getClangDecl ()) {
972
+ if (CD->isImplicit ()) continue ;
973
+ }
973
974
974
- auto inserted = visited.insert (D).second ;
975
- assert (inserted && " there should be no duplicate decls" );
975
+ auto inserted = visited.insert (D).second ;
976
+ assert (inserted && " there should be no duplicate decls" );
977
+ }
976
978
}
977
979
#endif
978
980
}
0 commit comments