diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-08 22:47:41 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-08 22:47:41 +0000 |
commit | 6f09c3d69f6272b101ff795562dffead1c0bd9de (patch) | |
tree | c909103105253c93003dd7a54a35dd8d4127204d /include/clang-c | |
parent | e4743be8984f9544878aee88b435f6381590878d (diff) |
[libclang] Change clang_findReferencesInFile and clang_findIncludesInFile to return an enum,
as suggested by Jordan.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang-c')
-rw-r--r-- | include/clang-c/Index.h | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index df7fa40664..07c0ffb443 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -5006,6 +5006,23 @@ typedef struct { enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); } CXCursorAndRangeVisitor; +typedef enum { + /** + * \brief Function returned successfully. + */ + CXResult_Success = 0, + /** + * \brief One of the parameters was invalid for the function. + */ + CXResult_Invalid = 1, + /** + * \brief The function was terminated by a callback (e.g. it returned + * CXVisit_Break) + */ + CXResult_VisitBreak = 2 + +} CXResult; + /** * \brief Find references of a declaration in a specific file. * @@ -5018,13 +5035,10 @@ typedef struct { * The CXSourceRange will point inside the file; if the reference is inside * a macro (and not a macro argument) the CXSourceRange will be invalid. * - * \returns - * 1 : if a parameter was invalid - * -1 : if the callback returned CXVisit_Break, - * otherwise returns 0. + * \returns one of the CXResult enumerators. */ -CINDEX_LINKAGE int clang_findReferencesInFile(CXCursor cursor, CXFile file, - CXCursorAndRangeVisitor visitor); +CINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file, + CXCursorAndRangeVisitor visitor); /** * \brief Find #import/#include directives in a specific file. @@ -5036,13 +5050,11 @@ CINDEX_LINKAGE int clang_findReferencesInFile(CXCursor cursor, CXFile file, * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for * each directive found. * - * \returns - * 1 : if a parameter was invalid - * -1 : if the callback returned CXVisit_Break, - * otherwise returns 0. + * \returns one of the CXResult enumerators. */ -CINDEX_LINKAGE int clang_findIncludesInFile(CXTranslationUnit TU, CXFile file, - CXCursorAndRangeVisitor visitor); +CINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU, + CXFile file, + CXCursorAndRangeVisitor visitor); #ifdef __has_feature # if __has_feature(blocks) @@ -5051,12 +5063,12 @@ typedef enum CXVisitorResult (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange); CINDEX_LINKAGE -int clang_findReferencesInFileWithBlock(CXCursor, CXFile, - CXCursorAndRangeVisitorBlock); +CXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile, + CXCursorAndRangeVisitorBlock); CINDEX_LINKAGE -int clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile, - CXCursorAndRangeVisitorBlock); +CXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile, + CXCursorAndRangeVisitorBlock); # endif #endif |