r203240 - [C++11] Replacing iterators ddiag_begin() and ddiag_end() with iterator_range ddiags(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman
aaron at aaronballman.com
Fri Mar 7 06:09:15 PST 2014
Author: aaronballman
Date: Fri Mar 7 08:09:15 2014
New Revision: 203240
URL: http://llvm.org/viewvc/llvm-project?rev=203240&view=rev
Log:
[C++11] Replacing iterators ddiag_begin() and ddiag_end() with iterator_range ddiags(). Updating all of the usages of the iterators with range-based for loops.
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/include/clang/AST/DependentDiagnostic.h
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=203240&r1=203239&r2=203240&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Fri Mar 7 08:09:15 2014
@@ -1589,8 +1589,9 @@ public:
// These are all defined in DependentDiagnostic.h.
class ddiag_iterator;
- inline ddiag_iterator ddiag_begin() const;
- inline ddiag_iterator ddiag_end() const;
+ typedef llvm::iterator_range<DeclContext::ddiag_iterator> ddiag_range;
+
+ inline ddiag_range ddiags() const;
// Low-level accessors
Modified: cfe/trunk/include/clang/AST/DependentDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DependentDiagnostic.h?rev=203240&r1=203239&r2=203240&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DependentDiagnostic.h (original)
+++ cfe/trunk/include/clang/AST/DependentDiagnostic.h Fri Mar 7 08:09:15 2014
@@ -171,18 +171,16 @@ private:
DependentDiagnostic *Ptr;
};
-inline DeclContext::ddiag_iterator DeclContext::ddiag_begin() const {
+inline DeclContext::ddiag_range DeclContext::ddiags() const {
assert(isDependentContext()
&& "cannot iterate dependent diagnostics of non-dependent context");
const DependentStoredDeclsMap *Map
= static_cast<DependentStoredDeclsMap*>(getPrimaryContext()->getLookupPtr());
- if (!Map) return ddiag_iterator();
- return ddiag_iterator(Map->FirstDiagnostic);
-}
+ if (!Map)
+ return ddiag_range();
-inline DeclContext::ddiag_iterator DeclContext::ddiag_end() const {
- return ddiag_iterator();
+ return ddiag_range(ddiag_iterator(Map->FirstDiagnostic), ddiag_iterator());
}
}
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=203240&r1=203239&r2=203240&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Fri Mar 7 08:09:15 2014
@@ -4674,10 +4674,7 @@ void Sema::PerformPendingInstantiations(
void Sema::PerformDependentDiagnostics(const DeclContext *Pattern,
const MultiLevelTemplateArgumentList &TemplateArgs) {
- for (DeclContext::ddiag_iterator I = Pattern->ddiag_begin(),
- E = Pattern->ddiag_end(); I != E; ++I) {
- DependentDiagnostic *DD = *I;
-
+ for (auto DD : Pattern->ddiags()) {
switch (DD->getKind()) {
case DependentDiagnostic::Access:
HandleDependentAccessCheck(*DD, TemplateArgs);
More information about the cfe-commits
mailing list