diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-30 22:15:48 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-03-30 22:15:48 +0000 |
commit | 34ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7b (patch) | |
tree | 39f0e1a110cba305b8ac3555c7473327af6f21ae /tools | |
parent | 50651b951c216573175e2145f32df2c4658ba3f9 (diff) |
[libclang] Introduce clang_Cursor_getObjCSelectorIndex() function.
After getting a cursor with clang_getCursor for a particular source location,
allows querying the cursor in order to find out if the location points to a
selector identifier in an objc method or message expression, and which selector index it is.
rdar://11158946
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153781 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/c-index-test/c-index-test.c | 2 | ||||
-rw-r--r-- | tools/libclang/CIndex.cpp | 4 | ||||
-rw-r--r-- | tools/libclang/libclang.exports | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c index e774e78086..873233575c 100644 --- a/tools/c-index-test/c-index-test.c +++ b/tools/c-index-test/c-index-test.c @@ -1464,6 +1464,8 @@ static int inspect_cursor_at(int argc, const char **argv) { printf(")"); } clang_disposeString(Spelling); + if (clang_Cursor_getObjCSelectorIndex(Cursor) != -1) + printf(" Selector index=%d",clang_Cursor_getObjCSelectorIndex(Cursor)); if (completionString != NULL) { printf("\nCompletion string: "); print_completion_string(completionString, stdout); diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index c63a969fe4..1896132fa0 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -4425,6 +4425,10 @@ CXCursor clang_getCanonicalCursor(CXCursor C) { return C; } + +int clang_Cursor_getObjCSelectorIndex(CXCursor cursor) { + return cxcursor::getSelectorIdentifierIndexAndLoc(cursor).first; +} unsigned clang_getNumOverloadedDecls(CXCursor C) { if (C.kind != CXCursor_OverloadedDeclRef) diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports index 2fe3f1d53c..95cfb025cb 100644 --- a/tools/libclang/libclang.exports +++ b/tools/libclang/libclang.exports @@ -6,6 +6,7 @@ clang_CXXMethod_isStatic clang_CXXMethod_isVirtual clang_Cursor_getSpellingNameRange clang_Cursor_getTranslationUnit +clang_Cursor_getObjCSelectorIndex clang_Cursor_isNull clang_IndexAction_create clang_IndexAction_dispose |