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

include/clang/AST/ASTContext.h
lib/Sema/SemaLookup.cpp

index 264170b6a69a67d59a1ff767348705573646b5ac..f449403b334166600368c8c3488fa102ac4acace 100644 (file)
@@ -2060,14 +2060,12 @@ public:
   //===--------------------------------------------------------------------===//
   //                    Type Iterators.
   //===--------------------------------------------------------------------===//
+  typedef llvm::iterator_range<SmallVectorImpl<Type *>::const_iterator>
+    type_const_range;
 
-  typedef SmallVectorImpl<Type *>::iterator       type_iterator;
-  typedef SmallVectorImpl<Type *>::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
index 77da08f8caa41660a3b0211e1cb8e761bf0bc01c..b3766a8c119b114a7a4f31ee3b1f297dd381e65e 100644 (file)
@@ -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() &&