diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-04-11 19:32:19 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-04-11 19:32:19 +0000 |
commit | d98ef9ae48ab4090d4d5d703ce65cfac62807fda (patch) | |
tree | 10f93d77fa3dec4dc2bef3c008d440205485da6b /include | |
parent | eba8cd5967e47592285590360bde73063c9c226f (diff) |
[libclang] Introduce a couple of functions to make it convenient
to get at the parameters (and their types) of a function or objc method cursor.
int clang_Cursor_getNumArguments(CXCursor C);
CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i);
rdar://11201527
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang-c/Index.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 4568a764e0..18316b4d33 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -2525,6 +2525,22 @@ CINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); CINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); /** + * \brief Retrieve the number of non-variadic arguments associated with a given + * cursor. + * + * If a cursor that is not a function or method is passed in, -1 is returned. + */ +CINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C); + +/** + * \brief Retrieve the argument cursor of a function or method. + * + * If a cursor that is not a function or method is passed in or the index + * exceeds the number of arguments, an invalid cursor is returned. + */ +CINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); + +/** * \determine Determine whether two CXTypes represent the same type. * * \returns non-zero if the CXTypes represent the same type and @@ -2598,9 +2614,9 @@ CINDEX_LINKAGE CXType clang_getResultType(CXType T); /** * \brief Retrieve the number of non-variadic arguments associated with a function type. * - * If a non-function type is passed in, UINT_MAX is returned. + * If a non-function type is passed in, -1 is returned. */ -CINDEX_LINKAGE unsigned clang_getNumArgTypes(CXType T); +CINDEX_LINKAGE int clang_getNumArgTypes(CXType T); /** * \brief Retrieve the type of an argument of a function type. |