diff options
Diffstat (limited to 'clang/tools/libclang')
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 10 | ||||
-rw-r--r-- | clang/tools/libclang/IndexDecl.cpp | 13 |
2 files changed, 9 insertions, 14 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index ac66a770db2..614bb0cbfc9 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -980,13 +980,11 @@ bool CursorVisitor::VisitObjCContainerDecl(ObjCContainerDecl *D) { // Get all the Decls in the DeclContext, and sort them with the // additional ones we've collected. Then visit them. - for (DeclContext::decl_iterator I = D->decls_begin(), E = D->decls_end(); - I!=E; ++I) { - Decl *subDecl = *I; - if (!subDecl || subDecl->getLexicalDeclContext() != D || - subDecl->getLocStart().isInvalid()) + for (auto *SubDecl : D->decls()) { + if (!SubDecl || SubDecl->getLexicalDeclContext() != D || + SubDecl->getLocStart().isInvalid()) continue; - DeclsInContainer.push_back(subDecl); + DeclsInContainer.push_back(SubDecl); } // Now sort the Decls so that they appear in lexical order. diff --git a/clang/tools/libclang/IndexDecl.cpp b/clang/tools/libclang/IndexDecl.cpp index d39076b974e..fbcd2d07a93 100644 --- a/clang/tools/libclang/IndexDecl.cpp +++ b/clang/tools/libclang/IndexDecl.cpp @@ -173,10 +173,9 @@ public: IvarE = D->ivar_end(); IvarI != IvarE; ++IvarI) { IndexCtx.indexDecl(*IvarI); } - for (DeclContext::decl_iterator - I = D->decls_begin(), E = D->decls_end(); I != E; ++I) { - if (!isa<ObjCIvarDecl>(*I)) - IndexCtx.indexDecl(*I); + for (const auto *I : D->decls()) { + if (!isa<ObjCIvarDecl>(I)) + IndexCtx.indexDecl(I); } return true; @@ -337,10 +336,8 @@ void IndexingContext::indexDecl(const Decl *D) { } void IndexingContext::indexDeclContext(const DeclContext *DC) { - for (DeclContext::decl_iterator - I = DC->decls_begin(), E = DC->decls_end(); I != E; ++I) { - indexDecl(*I); - } + for (const auto *I : DC->decls()) + indexDecl(I); } void IndexingContext::indexTopLevelDecl(const Decl *D) { |