File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -3082,23 +3082,26 @@ namespace Cpp {
30823082 clang::DeclContext *DC;
30833083 clang::DeclContext::decl_iterator decl;
30843084
3085+ llvm::SmallVector<clang::DeclContext*, 4 > DCs;
3086+
30853087 if (auto *TD = dyn_cast_or_null<TagDecl>(D)) {
30863088 DC = clang::TagDecl::castToDeclContext (TD);
3087- decl = DC->decls_begin ();
3088- decl++;
3089+ DCs.push_back (DC);
30893090 } else if (auto *ND = dyn_cast_or_null<NamespaceDecl>(D)) {
30903091 DC = clang::NamespaceDecl::castToDeclContext (ND);
3091- decl = DC->decls_begin ( );
3092+ DC->collectAllContexts (DCs );
30923093 } else if (auto *TUD = dyn_cast_or_null<TranslationUnitDecl>(D)) {
30933094 DC = clang::TranslationUnitDecl::castToDeclContext (TUD);
3094- decl = DC->decls_begin ( );
3095+ DC->collectAllContexts (DCs );
30953096 } else {
30963097 return ;
30973098 }
30983099
3099- for (/* decl set above */ ; decl != DC->decls_end (); decl++) {
3100- if (auto *ND = llvm::dyn_cast_or_null<EnumDecl>(*decl)) {
3101- Result.push_back (ND->getNameAsString ());
3100+ for (auto * DC : DCs) {
3101+ for (decl = DC->decls_begin (); decl != DC->decls_end (); decl++) {
3102+ if (auto * ND = llvm::dyn_cast_or_null<EnumDecl>(*decl)) {
3103+ Result.push_back (ND->getNameAsString ());
3104+ }
31023105 }
31033106 }
31043107 }
You can’t perform that action at this time.
0 commit comments