From: Aaron Ballman Date: Fri, 14 Mar 2014 21:11:14 +0000 (+0000) Subject: [C++11] Removing the types_begin() and types_end() APIs and replacing with a range... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4aa9d7e278ffdc70fbdc4a7d99ac31f7ef734646;p=clang [C++11] Removing the types_begin() and types_end() APIs and replacing with a range-only types() API. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203971 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 264170b6a6..f449403b33 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -2060,14 +2060,12 @@ public: //===--------------------------------------------------------------------===// // Type Iterators. //===--------------------------------------------------------------------===// + typedef llvm::iterator_range::const_iterator> + type_const_range; - typedef SmallVectorImpl::iterator type_iterator; - typedef SmallVectorImpl::const_iterator const_type_iterator; - - type_iterator types_begin() { return Types.begin(); } - type_iterator types_end() { return Types.end(); } - const_type_iterator types_begin() const { return Types.begin(); } - const_type_iterator types_end() const { return Types.end(); } + type_const_range types() const { + return type_const_range(Types.begin(), Types.end()); + } //===--------------------------------------------------------------------===// // Integer Values diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 77da08f8ca..b3766a8c11 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -4197,10 +4197,8 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, if (const Type *T = NNS->getAsType()) SSIsTemplate = T->getTypeClass() == Type::TemplateSpecialization; } - for (ASTContext::type_iterator TI = Context.types_begin(), - TIEnd = Context.types_end(); - TI != TIEnd; ++TI) { - if (CXXRecordDecl *CD = (*TI)->getAsCXXRecordDecl()) { + for (const auto *TI : Context.types()) { + if (CXXRecordDecl *CD = TI->getAsCXXRecordDecl()) { CD = CD->getCanonicalDecl(); if (!CD->isDependentType() && !CD->isAnonymousStructOrUnion() && !CD->isUnion() && CD->getIdentifier() &&