]> granicus.if.org Git - clang/commitdiff
[C++11] Removing the found_decls_begin() and found_decls_end() APIs and replacing...
authorAaron Ballman <aaron@aaronballman.com>
Fri, 14 Mar 2014 21:38:48 +0000 (21:38 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Fri, 14 Mar 2014 21:38:48 +0000 (21:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203975 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/CXXInheritance.h
lib/AST/CXXInheritance.cpp
lib/Sema/SemaDecl.cpp

index dbe4ad0f5a1d4964570ec622b97afcccfb521835..3c7b7f03a01d9d3695e73f2173f3c95dcdd5478d 100644 (file)
@@ -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_iterator> 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
index 98bfb81f87339415f06fcb24da5c364f784126df..eef043cc5a70c015033e93d7f9a37dfa9f75dbf0 100644 (file)
@@ -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
index 5b1815fe2022b915c0475baa5b656dfb964930f2..eba195386fa6558dfb596d33cd66bf1d920febb2 100644 (file)
@@ -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<CXXMethodDecl>(*I)) {
+    for (auto *I : Paths.found_decls()) {
+      if (CXXMethodDecl *OldMD = dyn_cast<CXXMethodDecl>(I)) {
         MD->addOverriddenMethod(OldMD->getCanonicalDecl());
         if (!CheckOverridingFunctionReturnType(MD, OldMD) &&
             !CheckOverridingFunctionAttributes(MD, OldMD) &&