diff options
| author | David Chisnall <csdavec@swan.ac.uk> | 2010-11-03 14:12:26 +0000 |
|---|---|---|
| committer | David Chisnall <csdavec@swan.ac.uk> | 2010-11-03 14:12:26 +0000 |
| commit | b2aa0ef310b08b1ea99768d2ee7757bb9c64dc86 (patch) | |
| tree | a961ebe5b036842d552d6ddfa5fba576f2e800a8 /clang/include/clang-c | |
| parent | 14627770176bf9a85a672908ba47ca488acc3f05 (diff) | |
| download | bcm5719-llvm-b2aa0ef310b08b1ea99768d2ee7757bb9c64dc86.tar.gz bcm5719-llvm-b2aa0ef310b08b1ea99768d2ee7757bb9c64dc86.zip | |
Added cursor visitor that takes a block as an argument. Tested compiling
libclang with both clang -fblocks and gcc (no blocks support). Only exposed in
the header to compilers that do have blocks support.
llvm-svn: 118170
Diffstat (limited to 'clang/include/clang-c')
| -rw-r--r-- | clang/include/clang-c/Index.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index bb76c564cc9..20c8c119946 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -1828,6 +1828,29 @@ typedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor, CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent, CXCursorVisitor visitor, CXClientData client_data); +#ifdef __has_feature +# if __has_feature(blocks) +/** + * \brief Visitor invoked for each cursor found by a traversal. + * + * This visitor block will be invoked for each cursor found by + * clang_visitChildrenWithBlock(). Its first argument is the cursor being + * visited, its second argument is the parent visitor for that cursor. + * + * The visitor should return one of the \c CXChildVisitResult values + * to direct clang_visitChildrenWithBlock(). + */ +typedef enum CXChildVisitResult + (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent); + +/** + * Visits the children of a cursor using the specified block. Behaves + * identically to clang_visitChildren() in all other respects. + */ +unsigned clang_visitChildrenWithBlock(CXCursor parent, + CXCursorVisitorBlock block); +# endif +#endif /** * @} |

