aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-08-04 20:04:59 +0000
committerDouglas Gregor <dgregor@apple.com>2011-08-04 20:04:59 +0000
commit8fa0a80b4482ad94e82c4a19e23de17fd69140b5 (patch)
tree690f18df1cf27cab3b3abc41040ffadba2e8fc1d /include
parent0e7bf40027f75c0c62fb002af7eab0882de6d332 (diff)
Add a new libclang API to return a CXCompletionString for an arbitrary
cursor, from Connor Wakamo! Addresses <rdar://problem/9087798>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136911 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang-c/Index.h12
-rw-r--r--include/clang/Frontend/ASTUnit.h14
2 files changed, 26 insertions, 0 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index e52ed46131..e16a21ef35 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -2899,6 +2899,18 @@ CINDEX_LINKAGE enum CXAvailabilityKind
clang_getCompletionAvailability(CXCompletionString completion_string);
/**
+ * \brief Retrieve a completion string for an arbitrary declaration or macro
+ * definition cursor.
+ *
+ * \param cursor The cursor to query.
+ *
+ * \returns A non-context-sensitive completion string for declaration and macro
+ * definition cursors, or NULL for other kinds of cursors.
+ */
+CINDEX_LINKAGE CXCompletionString
+clang_getCursorCompletionString(CXCursor cursor);
+
+/**
* \brief Contains the results of code-completion.
*
* This data structure contains the results of code completion, as
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h
index 6a3f9d5d42..4f81de53be 100644
--- a/include/clang/Frontend/ASTUnit.h
+++ b/include/clang/Frontend/ASTUnit.h
@@ -310,10 +310,24 @@ public:
return CachedCompletionAllocator;
}
+ /// \brief Retrieve the allocator used to cache global code completions.
+ /// Creates the allocator if it doesn't already exist.
+ llvm::IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
+ getCursorCompletionAllocator() {
+ if (!CursorCompletionAllocator.getPtr()) {
+ CursorCompletionAllocator = new GlobalCodeCompletionAllocator;
+ }
+ return CursorCompletionAllocator;
+ }
+
private:
/// \brief Allocator used to store cached code completions.
llvm::IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
CachedCompletionAllocator;
+
+ /// \brief Allocator used to store code completions for arbitrary cursors.
+ llvm::IntrusiveRefCntPtr<GlobalCodeCompletionAllocator>
+ CursorCompletionAllocator;
/// \brief The set of cached code-completion results.
std::vector<CachedCodeCompletionResult> CachedCompletionResults;