Handle redeclarations properly at the index-test tool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75605 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/index-test/index-test.cpp b/tools/index-test/index-test.cpp
index 63c86aa..a188cd1 100644
--- a/tools/index-test/index-test.cpp
+++ b/tools/index-test/index-test.cpp
@@ -134,15 +134,13 @@
   
   case PrintDecls :
     if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
-      while (FD) {
-        ASTLocation(FD).print(OS);
-        FD = FD->getPreviousDeclaration();
-      }
+      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)) {
-      while (VD) {
-        ASTLocation(VD).print(OS);
-        VD = VD->getPreviousDeclaration();
-      }
+      for (VarDecl::redecl_iterator I = VD->redecls_begin(),
+                                    E = VD->redecls_end(); I != E; ++I)
+        ASTLocation(*I).print(OS);
     } else
       ASTLocation(D).print(OS);
     break;