forked from OSchip/llvm-project
Handle redeclarations properly at the index-test tool.
llvm-svn: 75605
This commit is contained in:
parent
1506d9bc25
commit
12563b8111
|
@ -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) {
|
||||||
|
}
|
|
@ -134,15 +134,13 @@ static void ProcessDecl(Decl *D) {
|
||||||
|
|
||||||
case PrintDecls :
|
case PrintDecls :
|
||||||
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
|
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
|
||||||
while (FD) {
|
for (FunctionDecl::redecl_iterator I = FD->redecls_begin(),
|
||||||
ASTLocation(FD).print(OS);
|
E = FD->redecls_end(); I != E; ++I)
|
||||||
FD = FD->getPreviousDeclaration();
|
ASTLocation(*I).print(OS);
|
||||||
}
|
|
||||||
} else if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
|
} else if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
|
||||||
while (VD) {
|
for (VarDecl::redecl_iterator I = VD->redecls_begin(),
|
||||||
ASTLocation(VD).print(OS);
|
E = VD->redecls_end(); I != E; ++I)
|
||||||
VD = VD->getPreviousDeclaration();
|
ASTLocation(*I).print(OS);
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
ASTLocation(D).print(OS);
|
ASTLocation(D).print(OS);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue