diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-07-26 15:24:30 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-07-26 15:24:30 +0000 |
| commit | ea777403f999cba29ac23eee92fecbf996528a17 (patch) | |
| tree | 67a789ae9ca0c783057d625e0b1a2bee5d15dce7 /clang/include | |
| parent | b84dc6bca84274dc03157bbddeb6b80450cc9a4c (diff) | |
| download | bcm5719-llvm-ea777403f999cba29ac23eee92fecbf996528a17.tar.gz bcm5719-llvm-ea777403f999cba29ac23eee92fecbf996528a17.zip | |
Add new libclang API, clang_codeCompleteGetObjCSelector(), which
provides the partial Objective-C selector used in a code
completion. From Connor Wakamo!
llvm-svn: 136084
Diffstat (limited to 'clang/include')
| -rw-r--r-- | clang/include/clang-c/Index.h | 15 | ||||
| -rw-r--r-- | clang/include/clang/Sema/CodeCompleteConsumer.h | 21 |
2 files changed, 34 insertions, 2 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index d4fa9a2453e..0a73a644a3d 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -3234,6 +3234,21 @@ enum CXCursorKind clang_codeCompleteGetContainerKind( CINDEX_LINKAGE CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results); + +/** + * \brief Returns the currently-entered selector for an Objective-C message + * send, formatted like "initWithFoo:bar:". Only guaranteed to return a + * non-empty string for CXCompletionContext_ObjCInstanceMessage and + * CXCompletionContext_ObjCClassMessage. + * + * \param Results the code completion results to query + * + * \returns the selector (or partial selector) that has been entered thus far + * for an Objective-C message send. + */ +CINDEX_LINKAGE +CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results); + /** * @} */ diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h index 9b5564853c2..8c7a00280b5 100644 --- a/clang/include/clang/Sema/CodeCompleteConsumer.h +++ b/clang/include/clang/Sema/CodeCompleteConsumer.h @@ -268,12 +268,23 @@ private: /// \brief The type of the base object in a member access expression. QualType BaseType; + /// \brief The identifiers for Objective-C selector parts. + IdentifierInfo **SelIdents; + + /// \brief The number of Objective-C selector parts. + unsigned NumSelIdents; + public: /// \brief Construct a new code-completion context of the given kind. - CodeCompletionContext(enum Kind Kind) : Kind(Kind) { } + CodeCompletionContext(enum Kind Kind) : Kind(Kind), SelIdents(NULL), + NumSelIdents(0) { } /// \brief Construct a new code-completion context of the given kind. - CodeCompletionContext(enum Kind Kind, QualType T) : Kind(Kind) { + CodeCompletionContext(enum Kind Kind, QualType T, + IdentifierInfo **SelIdents = NULL, + unsigned NumSelIdents = 0) : Kind(Kind), + SelIdents(SelIdents), + NumSelIdents(NumSelIdents) { if (Kind == CCC_DotMemberAccess || Kind == CCC_ArrowMemberAccess || Kind == CCC_ObjCPropertyAccess || Kind == CCC_ObjCClassMessage || Kind == CCC_ObjCInstanceMessage) @@ -293,6 +304,12 @@ public: /// \brief Retrieve the type of the base object in a member-access /// expression. QualType getBaseType() const { return BaseType; } + + /// \brief Retrieve the Objective-C selector identifiers. + IdentifierInfo **getSelIdents() const { return SelIdents; } + + /// \brief Retrieve the number of Objective-C selector identifiers. + unsigned getNumSelIdents() const { return NumSelIdents; } /// \brief Determines whether we want C++ constructors as results within this /// context. |

