aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/IndexDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libclang/IndexDecl.cpp')
-rw-r--r--tools/libclang/IndexDecl.cpp52
1 files changed, 19 insertions, 33 deletions
diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp
index 89feb96d48e7..c8cf1d362147 100644
--- a/tools/libclang/IndexDecl.cpp
+++ b/tools/libclang/IndexDecl.cpp
@@ -31,7 +31,8 @@ public:
return MD && !MD->isImplicit() && MD->isThisDeclarationADefinition();
}
- void handleDeclarator(const DeclaratorDecl *D, const NamedDecl *Parent = 0) {
+ void handleDeclarator(const DeclaratorDecl *D,
+ const NamedDecl *Parent = nullptr) {
if (!Parent) Parent = D;
if (!IndexCtx.shouldIndexFunctionLocalSymbols()) {
@@ -41,10 +42,8 @@ public:
if (const ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
IndexCtx.handleVar(Parm);
} else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- for (FunctionDecl::param_const_iterator PI = FD->param_begin(),
- PE = FD->param_end();
- PI != PE; ++PI) {
- IndexCtx.handleVar(*PI);
+ for (auto PI : FD->params()) {
+ IndexCtx.handleVar(PI);
}
}
}
@@ -55,11 +54,9 @@ public:
if (D->isImplicit())
return;
- IndexCtx.indexTypeSourceInfo(D->getResultTypeSourceInfo(), D);
- for (ObjCMethodDecl::param_const_iterator I = D->param_begin(),
- E = D->param_end();
- I != E; ++I)
- handleDeclarator(*I, D);
+ IndexCtx.indexTypeSourceInfo(D->getReturnTypeSourceInfo(), D);
+ for (const auto *I : D->params())
+ handleDeclarator(I, D);
if (D->isThisDeclarationADefinition()) {
const Stmt *Body = D->getBody();
@@ -75,10 +72,7 @@ public:
if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(D)) {
// Constructor initializers.
- for (CXXConstructorDecl::init_const_iterator I = Ctor->init_begin(),
- E = Ctor->init_end();
- I != E; ++I) {
- CXXCtorInitializer *Init = *I;
+ for (const auto *Init : Ctor->inits()) {
if (Init->isWritten()) {
IndexCtx.indexTypeSourceInfo(Init->getTypeSourceInfo(), D);
if (const FieldDecl *Member = Init->getAnyMember())
@@ -172,15 +166,11 @@ public:
// Index the ivars first to make sure the synthesized ivars are indexed
// before indexing the methods that can reference them.
- for (ObjCImplementationDecl::ivar_iterator
- IvarI = D->ivar_begin(),
- IvarE = D->ivar_end(); IvarI != IvarE; ++IvarI) {
- IndexCtx.indexDecl(*IvarI);
- }
- for (DeclContext::decl_iterator
- I = D->decls_begin(), E = D->decls_end(); I != E; ++I) {
- if (!isa<ObjCIvarDecl>(*I))
- IndexCtx.indexDecl(*I);
+ for (const auto *IvarI : D->ivars())
+ IndexCtx.indexDecl(IvarI);
+ for (const auto *I : D->decls()) {
+ if (!isa<ObjCIvarDecl>(I))
+ IndexCtx.indexDecl(I);
}
return true;
@@ -238,7 +228,7 @@ public:
if (ObjCIvarDecl *IvarD = D->getPropertyIvarDecl()) {
if (!IvarD->getSynthesize())
- IndexCtx.handleReference(IvarD, D->getPropertyIvarDeclLoc(), 0,
+ IndexCtx.handleReference(IvarD, D->getPropertyIvarDeclLoc(), nullptr,
D->getDeclContext());
}
@@ -268,11 +258,9 @@ public:
// we should do better.
IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), D);
- for (UsingDecl::shadow_iterator
- I = D->shadow_begin(), E = D->shadow_end(); I != E; ++I) {
- IndexCtx.handleReference((*I)->getUnderlyingDecl(), D->getLocation(),
- D, D->getLexicalDeclContext());
- }
+ for (const auto *I : D->shadows())
+ IndexCtx.handleReference(I->getUnderlyingDecl(), D->getLocation(), D,
+ D->getLexicalDeclContext());
return true;
}
@@ -341,10 +329,8 @@ void IndexingContext::indexDecl(const Decl *D) {
}
void IndexingContext::indexDeclContext(const DeclContext *DC) {
- for (DeclContext::decl_iterator
- I = DC->decls_begin(), E = DC->decls_end(); I != E; ++I) {
- indexDecl(*I);
- }
+ for (const auto *I : DC->decls())
+ indexDecl(I);
}
void IndexingContext::indexTopLevelDecl(const Decl *D) {