* for only one reference of an entity per source file that does not also
* include a declaration/definition of the entity.
*/
- CXIndexOpt_SuppressRedundantRefs = 0x1
+ CXIndexOpt_SuppressRedundantRefs = 0x1,
+
+ /**
+ * \brief Function-local symbols should be indexed. If this is not set
+ * function-local symbols will be ignored.
+ */
+ CXIndexOpt_IndexFunctionLocalSymbols = 0x2
} CXIndexOptFlags;
/**
index_indexEntityReference
};
+static unsigned getIndexOptions(void) {
+ unsigned index_opts;
+ index_opts = 0;
+ if (getenv("CINDEXTEST_SUPPRESSREFS"))
+ index_opts |= CXIndexOpt_SuppressRedundantRefs;
+ if (getenv("CINDEXTEST_INDEXLOCALSYMBOLS"))
+ index_opts |= CXIndexOpt_IndexFunctionLocalSymbols;
+
+ return index_opts;
+}
+
static int index_file(int argc, const char **argv) {
const char *check_prefix;
CXIndex Idx;
index_data.fail_for_error = 0;
index_data.abort = 0;
- index_opts = 0;
- if (getenv("CINDEXTEST_SUPPRESSREFS"))
- index_opts |= CXIndexOpt_SuppressRedundantRefs;
-
+ index_opts = getIndexOptions();
idxAction = clang_IndexAction_create(Idx);
result = clang_indexSourceFile(idxAction, &index_data,
&IndexCB,sizeof(IndexCB), index_opts,
index_data.fail_for_error = 0;
index_data.abort = 0;
- index_opts = 0;
- if (getenv("CINDEXTEST_SUPPRESSREFS"))
- index_opts |= CXIndexOpt_SuppressRedundantRefs;
-
+ index_opts = getIndexOptions();
idxAction = clang_IndexAction_create(Idx);
result = clang_indexTranslationUnit(idxAction, &index_data,
&IndexCB,sizeof(IndexCB),