aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-16 02:34:59 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-16 02:34:59 +0000
commitc6b4a5099588fd21b49c80f730a596a64b2766c6 (patch)
tree10db8d9ef00e48879206fc21dfccdb418e54cc06 /tools/c-index-test
parent220b45c95edc0ea86cd157426e0edc7f6a288620 (diff)
[libclang] Indexing API: if the CXIndexOpt_OneRefPerFile option is set, only report one reference
per file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144763 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test')
-rw-r--r--tools/c-index-test/c-index-test.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index ed58fd28fb..56b555213a 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -1645,6 +1645,11 @@ static void printEntityInfo(const char *cb,
index_data = (IndexData *)client_data;
printCheck(index_data);
+ if (!info) {
+ printf("%s: <<NULL>>", cb);
+ return;
+ }
+
name = info->name;
if (!name)
name = "<anon-tag>";
@@ -1848,7 +1853,8 @@ static int index_file(int argc, const char **argv) {
result = clang_indexSourceFile(CIdx, &index_data,
&IndexCB,sizeof(IndexCB),
- 0, 0, argv, argc, 0, 0, 0, 0);
+ CXIndexOpt_OneRefPerFile,
+ 0, argv, argc, 0, 0, 0, 0);
if (index_data.fail_for_error)
return -1;
@@ -1890,7 +1896,8 @@ static int index_tu(int argc, const char **argv) {
index_data.fail_for_error = 0;
result = clang_indexTranslationUnit(TU, &index_data,
- &IndexCB,sizeof(IndexCB), 0);
+ &IndexCB,sizeof(IndexCB),
+ CXIndexOpt_OneRefPerFile);
if (index_data.fail_for_error)
return -1;