diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-06 07:00:54 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-06 07:00:54 +0000 |
| commit | cddafd3969977630d9bbec724dd09b6cb97fd9fd (patch) | |
| tree | 47505b09dfb01fe57cef3c6fd98fd4d3eb6ca073 /clang/include/clang-c | |
| parent | 3b947f72da42a2ea3dc496e9edfb265edf29ad56 (diff) | |
| download | bcm5719-llvm-cddafd3969977630d9bbec724dd09b6cb97fd9fd.tar.gz bcm5719-llvm-cddafd3969977630d9bbec724dd09b6cb97fd9fd.zip | |
[libclang] Introduce clang_findReferencesInFile which accepts a cursor, a file,
and a callback and finds all identifier references of the cursor in the file.
rdar://7948304
llvm-svn: 141277
Diffstat (limited to 'clang/include/clang-c')
| -rw-r--r-- | clang/include/clang-c/Index.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 65d05e50943..05ac19bb23d 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -1857,6 +1857,7 @@ enum CXCursorKind { */ typedef struct { enum CXCursorKind kind; + int xdata; void *data[3]; } CXCursor; @@ -3779,6 +3780,53 @@ CINDEX_LINKAGE void clang_remap_dispose(CXRemapping); * @} */ +/** \defgroup CINDEX_HIGH Higher level API functions + * + * @{ + */ + +enum CXVisitorResult { + CXVisit_Break, + CXVisit_Continue +}; + +typedef struct { + void *context; + enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); +} CXCursorAndRangeVisitor; + +/** + * \brief Find references of a declaration in a specific file. + * + * \param cursor pointing to a declaration or a reference of one. + * + * \param file to search for references. + * + * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for + * each reference found. + * The CXSourceRange will point inside the file; if the reference is inside + * a macro (and not a macro argument) the CXSourceRange will be invalid. + */ +CINDEX_LINKAGE void clang_findReferencesInFile(CXCursor cursor, CXFile file, + CXCursorAndRangeVisitor visitor); + +#ifdef __has_feature +# if __has_feature(blocks) + +typedef enum CXVisitorResult + (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange); + +CINDEX_LINKAGE +void clang_findReferencesInFileWithBlock(CXCursor, CXFile, + CXCursorAndRangeVisitorBlock); + +# endif +#endif + +/** + * @} + */ + /** * @} */ |

