From: Aaron Ballman Date: Fri, 14 Mar 2014 21:38:48 +0000 (+0000) Subject: [C++11] Removing the found_decls_begin() and found_decls_end() APIs and replacing... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02242c339a094e7a04f2280d5fbb97f9f5fb6d36;p=clang [C++11] Removing the found_decls_begin() and found_decls_end() APIs and replacing with a range-only found_decls() API. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203975 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/CXXInheritance.h b/include/clang/AST/CXXInheritance.h index dbe4ad0f5a..3c7b7f03a0 100644 --- a/include/clang/AST/CXXInheritance.h +++ b/include/clang/AST/CXXInheritance.h @@ -190,8 +190,8 @@ public: CXXBasePath& front() { return Paths.front(); } const CXXBasePath& front() const { return Paths.front(); } - decl_iterator found_decls_begin(); - decl_iterator found_decls_end(); + typedef llvm::iterator_range decl_range; + decl_range found_decls(); /// \brief Determine whether the path from the most-derived type to the /// given base type is ambiguous (i.e., it refers to multiple subobjects of diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp index 98bfb81f87..eef043cc5a 100644 --- a/lib/AST/CXXInheritance.cpp +++ b/lib/AST/CXXInheritance.cpp @@ -35,16 +35,12 @@ void CXXBasePaths::ComputeDeclsFound() { std::copy(Decls.begin(), Decls.end(), DeclsFound); } -CXXBasePaths::decl_iterator CXXBasePaths::found_decls_begin() { +CXXBasePaths::decl_range CXXBasePaths::found_decls() { if (NumDeclsFound == 0) ComputeDeclsFound(); - return DeclsFound; -} -CXXBasePaths::decl_iterator CXXBasePaths::found_decls_end() { - if (NumDeclsFound == 0) - ComputeDeclsFound(); - return DeclsFound + NumDeclsFound; + return decl_range(decl_iterator(DeclsFound), + decl_iterator(DeclsFound + NumDeclsFound)); } /// isAmbiguous - Determines whether the set of paths provided is diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 5b1815fe20..eba195386f 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -5941,9 +5941,8 @@ bool Sema::AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD) { bool hasNonDeletedOverridenMethods = false; bool AddedAny = false; if (DC->lookupInBases(&FindOverriddenMethod, &Data, Paths)) { - for (CXXBasePaths::decl_iterator I = Paths.found_decls_begin(), - E = Paths.found_decls_end(); I != E; ++I) { - if (CXXMethodDecl *OldMD = dyn_cast(*I)) { + for (auto *I : Paths.found_decls()) { + if (CXXMethodDecl *OldMD = dyn_cast(I)) { MD->addOverriddenMethod(OldMD->getCanonicalDecl()); if (!CheckOverridingFunctionReturnType(MD, OldMD) && !CheckOverridingFunctionAttributes(MD, OldMD) &&