r203971 - [C++11] Removing the types_begin() and types_end() APIs and replacing with a range-only types() API.
Aaron Ballman
aaron at aaronballman.com
Fri Mar 14 14:11:14 PDT 2014
Author: aaronballman
Date: Fri Mar 14 16:11:14 2014
New Revision: 203971
URL: http://llvm.org/viewvc/llvm-project?rev=203971&view=rev
Log:
[C++11] Removing the types_begin() and types_end() APIs and replacing with a range-only types() API.
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/lib/Sema/SemaLookup.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=203971&r1=203970&r2=203971&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Fri Mar 14 16:11:14 2014
@@ -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
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=203971&r1=203970&r2=203971&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Mar 14 16:11:14 2014
@@ -4197,10 +4197,8 @@ TypoCorrection Sema::CorrectTypo(const D
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() &&
More information about the cfe-commits
mailing list