[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.

llvm-svn: 203240
This commit is contained in:
Aaron Ballman 2014-03-07 14:09:15 +00:00
parent 63ab760ebe
commit b105e49f28
3 changed files with 8 additions and 12 deletions

View File

@ -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

View File

@ -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());
}
}

View File

@ -4674,10 +4674,7 @@ void Sema::PerformPendingInstantiations(bool LocalOnly) {
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);