[cfe-commits] r75605 - in /cfe/trunk: test/Index/multiple-redecls.c tools/index-test/index-test.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Mon Jul 13 20:20:31 PDT 2009
Author: akirtzidis
Date: Mon Jul 13 22:20:31 2009
New Revision: 75605
URL: http://llvm.org/viewvc/llvm-project?rev=75605&view=rev
Log:
Handle redeclarations properly at the index-test tool.
Added:
cfe/trunk/test/Index/multiple-redecls.c
Modified:
cfe/trunk/tools/index-test/index-test.cpp
Added: cfe/trunk/test/Index/multiple-redecls.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/multiple-redecls.c?rev=75605&view=auto
==============================================================================
--- cfe/trunk/test/Index/multiple-redecls.c (added)
+++ cfe/trunk/test/Index/multiple-redecls.c Mon Jul 13 22:20:31 2009
@@ -0,0 +1,12 @@
+// RUN: clang-cc -emit-pch %s -o %t.ast &&
+// RUN: index-test %t.ast -point-at %s:8:4 -print-decls | count 2 &&
+// RUN: index-test %t.ast -point-at %s:8:4 -print-defs | count 1
+
+static void foo(int x);
+
+static void bar(void) {
+ foo(10);
+}
+
+void foo(int x) {
+}
Modified: cfe/trunk/tools/index-test/index-test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/index-test/index-test.cpp?rev=75605&r1=75604&r2=75605&view=diff
==============================================================================
--- cfe/trunk/tools/index-test/index-test.cpp (original)
+++ cfe/trunk/tools/index-test/index-test.cpp Mon Jul 13 22:20:31 2009
@@ -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;
More information about the cfe-commits
mailing list