Introduce a redecl_iterator in Decl class, so that we can do a "iterate over all declarations of the same decl" without knowing the exact type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76298 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/index-test/index-test.cpp b/tools/index-test/index-test.cpp
index a188cd1..10449ed 100644
--- a/tools/index-test/index-test.cpp
+++ b/tools/index-test/index-test.cpp
@@ -133,16 +133,9 @@
}
case PrintDecls :
- if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- for (FunctionDecl::redecl_iterator I = FD->redecls_begin(),
- E = FD->redecls_end(); I != E; ++I)
- ASTLocation(*I).print(OS);
- } else if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
- for (VarDecl::redecl_iterator I = VD->redecls_begin(),
- E = VD->redecls_end(); I != E; ++I)
- ASTLocation(*I).print(OS);
- } else
- ASTLocation(D).print(OS);
+ for (Decl::redecl_iterator I = D->redecls_begin(),
+ E = D->redecls_end(); I != E; ++I)
+ ASTLocation(*I).print(OS);
break;
}