From e86f4c65cdb0b1823fdcfa17038ba852990c8b79 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 23 Mar 2015 13:43:08 -0400 Subject: Output: Simplify name lookup result traversal Use a range-based for loop instead of explicit iterators. --- src/Output.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Output.cxx b/src/Output.cxx index 6299cb8..2608704 100644 --- a/src/Output.cxx +++ b/src/Output.cxx @@ -1642,18 +1642,17 @@ void ASTVisitor::LookupStart(clang::DeclContext const* dc, std::string cur = name.substr(0, pos); clang::IdentifierTable& ids = CI.getPreprocessor().getIdentifierTable(); - clang::DeclContext::lookup_const_result r = + clang::DeclContext::lookup_const_result result = dc->lookup(clang::DeclarationName(&ids.get(cur))); if(pos == name.npos) { - for(clang::DeclContext::lookup_const_iterator i = r.begin(), e = r.end(); - i != e; ++i) { - this->AddStartDecl(*i); + for (clang::NamedDecl const* n: result) { + this->AddStartDecl(n); } } else { std::string rest = name.substr(pos+2); - for(clang::DeclContext::lookup_const_iterator i = r.begin(), e = r.end(); - i != e; ++i) { - if (clang::DeclContext* idc = clang::dyn_cast(*i)) { + for (clang::NamedDecl const* n: result) { + if (clang::DeclContext const* idc = + clang::dyn_cast(n)) { this->LookupStart(idc, rest); } } -- cgit v0.12