// Lookup in a base class succeeded; return these results.
- DeclContext::lookup_result DR = Paths.front().Decls;
- for (DeclContext::lookup_iterator I = DR.begin(), E = DR.end(); I != E; ++I) {
- NamedDecl *D = *I;
+ for (auto *D : Paths.front().Decls) {
AccessSpecifier AS = CXXRecordDecl::MergeAccess(SubobjectAccess,
D->getAccess());
R.addDecl(D, AS);
llvm::SmallPtrSet<NamedDecl*,8> TagDecls;
- LookupResult::iterator DI, DE = Result.end();
- for (DI = Result.begin(); DI != DE; ++DI)
- if (TagDecl *TD = dyn_cast<TagDecl>(*DI)) {
+ for (auto *D : Result)
+ if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
TagDecls.insert(TD);
Diag(TD->getLocation(), diag::note_hidden_tag);
}
- for (DI = Result.begin(); DI != DE; ++DI)
- if (!isa<TagDecl>(*DI))
- Diag((*DI)->getLocation(), diag::note_hiding_object);
+ for (auto *D : Result)
+ if (!isa<TagDecl>(D))
+ Diag(D->getLocation(), diag::note_hiding_object);
// For recovery purposes, go ahead and implement the hiding.
LookupResult::Filter F = Result.makeFilter();
case LookupResult::AmbiguousReference: {
Diag(NameLoc, diag::err_ambiguous_reference) << Name << LookupRange;
- LookupResult::iterator DI = Result.begin(), DE = Result.end();
- for (; DI != DE; ++DI)
- Diag((*DI)->getLocation(), diag::note_ambiguous_candidate) << *DI;
+ for (auto *D : Result)
+ Diag(D->getLocation(), diag::note_ambiguous_candidate) << D;
break;
}
}
UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Arg);
if (!ULE) continue;
- for (UnresolvedSetIterator I = ULE->decls_begin(), E = ULE->decls_end();
- I != E; ++I) {
+ for (const auto *D : ULE->decls()) {
// Look through any using declarations to find the underlying function.
- FunctionDecl *FDecl = (*I)->getUnderlyingDecl()->getAsFunction();
+ const FunctionDecl *FDecl = D->getUnderlyingDecl()->getAsFunction();
// Add the classes and namespaces associated with the parameter
// types and return type of this function.
// from an external source and invalidate lookup_result.
SmallVector<NamedDecl *, 8> Candidates(R.begin(), R.end());
- for (SmallVectorImpl<NamedDecl *>::iterator I = Candidates.begin(),
- E = Candidates.end();
- I != E; ++I) {
- NamedDecl *Cand = *I;
-
+ for (auto *Cand : Candidates) {
if (Cand->isInvalidDecl())
continue;
//
// Here, we compute Y and add its members to the overloaded
// candidate set.
- for (AssociatedNamespaceSet::iterator NS = AssociatedNamespaces.begin(),
- NSEnd = AssociatedNamespaces.end();
- NS != NSEnd; ++NS) {
+ for (auto *NS : AssociatedNamespaces) {
// When considering an associated namespace, the lookup is the
// same as the lookup performed when the associated namespace is
// used as a qualifier (3.4.3.2) except that:
// associated classes are visible within their respective
// namespaces even if they are not visible during an ordinary
// lookup (11.4).
- DeclContext::lookup_result R = (*NS)->lookup(Name);
- for (DeclContext::lookup_iterator I = R.begin(), E = R.end(); I != E;
- ++I) {
- NamedDecl *D = *I;
+ DeclContext::lookup_result R = NS->lookup(Name);
+ for (auto *D : R) {
// If the only declaration here is an ordinary friend, consider
// it only if it was declared in an associated classes.
if ((D->getIdentifierNamespace() & Decl::IDNS_Ordinary) == 0) {
if (Pos == SM->end())
continue;
- for (ShadowMapEntry::iterator I = Pos->second.begin(),
- IEnd = Pos->second.end();
- I != IEnd; ++I) {
+ for (auto *D : Pos->second) {
// A tag declaration does not hide a non-tag declaration.
- if ((*I)->hasTagIdentifierNamespace() &&
+ if (D->hasTagIdentifierNamespace() &&
(IDNS & (Decl::IDNS_Member | Decl::IDNS_Ordinary |
Decl::IDNS_ObjCProtocol)))
continue;
// Protocols are in distinct namespaces from everything else.
- if ((((*I)->getIdentifierNamespace() & Decl::IDNS_ObjCProtocol)
+ if (((D->getIdentifierNamespace() & Decl::IDNS_ObjCProtocol)
|| (IDNS & Decl::IDNS_ObjCProtocol)) &&
- (*I)->getIdentifierNamespace() != IDNS)
+ D->getIdentifierNamespace() != IDNS)
continue;
// Functions and function templates in the same scope overload
// rather than hide. FIXME: Look for hiding based on function
// signatures!
- if ((*I)->getUnderlyingDecl()->isFunctionOrFunctionTemplate() &&
+ if (D->getUnderlyingDecl()->isFunctionOrFunctionTemplate() &&
ND->getUnderlyingDecl()->isFunctionOrFunctionTemplate() &&
SM == ShadowMaps.rbegin())
continue;
// We've found a declaration that hides this one.
- return *I;
+ return D;
}
}
std::sort(sortedDistances.begin(), sortedDistances.end());
Specifiers.clear();
- for (SmallVectorImpl<unsigned>::iterator DI = sortedDistances.begin(),
- DIEnd = sortedDistances.end();
- DI != DIEnd; ++DI) {
- SpecifierInfoList &SpecList = DistanceMap[*DI];
+ for (auto D : sortedDistances) {
+ SpecifierInfoList &SpecList = DistanceMap[D];
Specifiers.append(SpecList.begin(), SpecList.end());
}
// For unqualified lookup, look through all of the names that we have
// seen in this translation unit.
// FIXME: Re-add the ability to skip very unlikely potential corrections.
- for (IdentifierTable::iterator I = Context.Idents.begin(),
- IEnd = Context.Idents.end();
- I != IEnd; ++I)
- Consumer.FoundName(I->getKey());
+ for (const auto &I : Context.Idents)
+ Consumer.FoundName(I.getKey());
// Walk through identifiers in external identifier sources.
// FIXME: Re-add the ability to skip very unlikely potential corrections.
SmallVector<NamespaceDecl *, 4> ExternalKnownNamespaces;
LoadedExternalKnownNamespaces = true;
ExternalSource->ReadKnownNamespaces(ExternalKnownNamespaces);
- for (unsigned I = 0, N = ExternalKnownNamespaces.size(); I != N; ++I)
- KnownNamespaces[ExternalKnownNamespaces[I]] = true;
+ for (auto *N : ExternalKnownNamespaces)
+ KnownNamespaces[N] = true;
}
Consumer.addNamespaces(KnownNamespaces);
if (!candidate.getCorrectionDecl())
return candidate.isKeyword();
- for (TypoCorrection::const_decl_iterator DI = candidate.begin(),
- DIEnd = candidate.end();
- DI != DIEnd; ++DI) {
+ for (auto *C : candidate) {
FunctionDecl *FD = nullptr;
- NamedDecl *ND = (*DI)->getUnderlyingDecl();
+ NamedDecl *ND = C->getUnderlyingDecl();
if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(ND))
FD = FTD->getTemplatedDecl();
if (!HasExplicitTemplateArgs && !FD) {