summaryrefslogtreecommitdiffstats
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-09-01 15:55:40 +0000
committerSteve Naroff <snaroff@apple.com>2009-09-01 15:55:40 +0000
commit69b10fd2c5aad82caeee42769753942e930ba9d4 (patch)
tree9611d905eed85419987408845b9d1b8466d2ca8c /clang/tools/c-index-test/c-index-test.c
parent810f7a9d956c29c0db4794dac45f0ff05479654e (diff)
downloadbcm5719-llvm-69b10fd2c5aad82caeee42769753942e930ba9d4.tar.gz
bcm5719-llvm-69b10fd2c5aad82caeee42769753942e930ba9d4.zip
Add explicit "blind" client data to callback function (since we aren't using blocks).
llvm-svn: 80673
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 1ef8e924bc3..30700d8ae3f 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -1,14 +1,18 @@
+/* c-index-test.c */
#include "clang-c/Index.h"
#include <stdio.h>
-static void PrintDecls(CXTranslationUnit Unit, CXCursor Cursor) {
+static void PrintDecls(CXTranslationUnit Unit, CXCursor Cursor,
+ CXClientData Filter) {
if (clang_isDeclaration(Cursor.kind)) {
- printf("%s => %s", clang_getKindSpelling(Cursor.kind),
- clang_getDeclSpelling(Cursor.decl));
- printf(" (%s,%d:%d)\n", clang_getCursorSource(Cursor),
- clang_getCursorLine(Cursor),
- clang_getCursorColumn(Cursor));
+ if (Cursor.kind == *(enum CXCursorKind *)Filter) {
+ printf("%s => %s", clang_getKindSpelling(Cursor.kind),
+ clang_getDeclSpelling(Cursor.decl));
+ printf(" (%s,%d:%d)\n", clang_getCursorSource(Cursor),
+ clang_getCursorLine(Cursor),
+ clang_getCursorColumn(Cursor));
+ }
}
}
@@ -18,6 +22,9 @@ static void PrintDecls(CXTranslationUnit Unit, CXCursor Cursor) {
int main(int argc, char **argv) {
CXIndex Idx = clang_createIndex();
CXTranslationUnit TU = clang_createTranslationUnit(Idx, argv[1]);
- clang_loadTranslationUnit(TU, PrintDecls);
+
+ /* Use client data to only print ObjC interfaces */
+ enum CXCursorKind filterData = CXCursor_ObjCInterfaceDecl;
+ clang_loadTranslationUnit(TU, PrintDecls, &filterData);
return 1;
}
OpenPOWER on IntegriCloud