summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-09-03 00:32:06 +0000
committerSteve Naroff <snaroff@apple.com>2009-09-03 00:32:06 +0000
commitef3cf2a576d5e31ca5bb39a664e092496b6ed082 (patch)
tree29b5d5bbbc92e042953f261f5f7400d387bb246a /clang/tools/c-index-test/c-index-test.c
parent14dfba6d6691218a791942429f5b3d19ca8f6980 (diff)
downloadbcm5719-llvm-ef3cf2a576d5e31ca5bb39a664e092496b6ed082.tar.gz
bcm5719-llvm-ef3cf2a576d5e31ca5bb39a664e092496b6ed082.zip
Visit function/method bodies and issue callback for parameters and local variables.
Add clang_getTranslationUnitSpelling(). llvm-svn: 80859
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 2d2be158d06..8df2fc261dc 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -3,25 +3,27 @@
#include "clang-c/Index.h"
#include <stdio.h>
+static void PrintCursor(CXCursor Cursor) {
+ printf("%s => %s", clang_getCursorKindSpelling(Cursor.kind),
+ clang_getCursorSpelling(Cursor));
+ printf(" (%s,%d:%d)\n", clang_getCursorSource(Cursor),
+ clang_getCursorLine(Cursor),
+ clang_getCursorColumn(Cursor));
+}
+
static void DeclVisitor(CXDecl Dcl, CXCursor Cursor, CXClientData Filter)
{
- if (!Filter || (Cursor.kind == *(enum CXCursorKind *)Filter)) {
- printf("%s => %s", clang_getCursorKindSpelling(Cursor.kind),
- clang_getCursorSpelling(Cursor));
- printf(" (%s,%d:%d)\n", clang_getCursorSource(Cursor),
- clang_getCursorLine(Cursor),
- clang_getCursorColumn(Cursor));
- }
+ printf("%s: ", clang_getDeclSpelling(Dcl));
+ if (!Filter || (Cursor.kind == *(enum CXCursorKind *)Filter))
+ PrintCursor(Cursor);
}
+
static void TranslationUnitVisitor(CXTranslationUnit Unit, CXCursor Cursor,
CXClientData Filter)
{
+ printf("%s: ", clang_getTranslationUnitSpelling(Unit));
if (!Filter || (Cursor.kind == *(enum CXCursorKind *)Filter)) {
- printf("%s => %s", clang_getCursorKindSpelling(Cursor.kind),
- clang_getCursorSpelling(Cursor));
- printf(" (%s,%d:%d)\n", clang_getCursorSource(Cursor),
- clang_getCursorLine(Cursor),
- clang_getCursorColumn(Cursor));
+ PrintCursor(Cursor);
clang_loadDeclaration(Cursor.decl, DeclVisitor, 0);
}
OpenPOWER on IntegriCloud