@@ -949,30 +949,32 @@ SourceFile::getExternalRawLocsForDecl(const Decl *D) const {
949949 return Result;
950950}
951951
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 )) {
954954 SmallPtrSet<ModuleDecl *, 4 > Modules;
955955 collectParsedExportedImports (this , Modules);
956956 for (const ModuleDecl *import : Modules) {
957- import ->getDisplayDecls (Results);
957+ import ->getDisplayDecls (Results, Recursive );
958958 }
959959 }
960960 // FIXME: Should this do extra access control filtering?
961961 FORWARD (getDisplayDecls, (Results));
962962
963963#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+ }
973974
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+ }
976978 }
977979#endif
978980}
0 commit comments