diff --git a/clang/include/clang/Sema/Scope.h b/clang/include/clang/Sema/Scope.h index ccc7973c777c..54ca2a6bb64d 100644 --- a/clang/include/clang/Sema/Scope.h +++ b/clang/include/clang/Sema/Scope.h @@ -361,27 +361,16 @@ public: /// is a FunctionPrototypeScope. bool containedInPrototypeScope() const; - typedef UsingDirectivesTy::iterator udir_iterator; - typedef UsingDirectivesTy::const_iterator const_udir_iterator; - void PushUsingDirective(UsingDirectiveDecl *UDir) { UsingDirectives.push_back(UDir); } - udir_iterator using_directives_begin() { - return UsingDirectives.begin(); - } + typedef llvm::iterator_range + using_directives_range; - udir_iterator using_directives_end() { - return UsingDirectives.end(); - } - - const_udir_iterator using_directives_begin() const { - return UsingDirectives.begin(); - } - - const_udir_iterator using_directives_end() const { - return UsingDirectives.end(); + using_directives_range using_directives() { + return using_directives_range(UsingDirectives.begin(), + UsingDirectives.end()); } /// Init - This is used by the parser to implement scope caching. diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 3adea40387dd..29671aa65d4d 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -113,10 +113,8 @@ namespace { if (Ctx && Ctx->isFileContext()) { visit(Ctx, Ctx); } else if (!Ctx || Ctx->isFunctionOrMethod()) { - Scope::udir_iterator I = S->using_directives_begin(), - End = S->using_directives_end(); - for (; I != End; ++I) - visit(*I, InnermostFileDC); + for (auto *I : S->using_directives()) + visit(I, InnermostFileDC); } } }