aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/CodeCompleteConsumer.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-17 00:22:45 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-17 00:22:45 +0000
commit577cdfdb20840350e841a483df630237326126d5 (patch)
tree1501215a392dc984ffdd6ef2be32e1119fc20d9b /lib/Sema/CodeCompleteConsumer.cpp
parenta03733b28b7c0a6dde83561a8a391c1067f404a5 (diff)
Implement code completion results for the Objective-C Key-Value Coding
(KVC) and Key-Value Observing (KVO) protocols. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125696 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r--lib/Sema/CodeCompleteConsumer.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp
index cb2dd234b4..253c10e7d5 100644
--- a/lib/Sema/CodeCompleteConsumer.cpp
+++ b/lib/Sema/CodeCompleteConsumer.cpp
@@ -19,6 +19,7 @@
#include "clang/Lex/Preprocessor.h"
#include "clang-c/Index.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cstring>
@@ -227,6 +228,14 @@ const char *CodeCompletionAllocator::CopyString(llvm::StringRef String) {
return Mem;
}
+const char *CodeCompletionAllocator::CopyString(llvm::Twine String) {
+ // FIXME: It would be more efficient to teach Twine to tell us its size and
+ // then add a routine there to fill in an allocated char* with the contents
+ // of the string.
+ llvm::SmallString<128> Data;
+ return CopyString(String.toStringRef(Data));
+}
+
CodeCompletionString *CodeCompletionBuilder::TakeString() {
void *Mem = Allocator.Allocate(
sizeof(CodeCompletionString) + sizeof(Chunk) * Chunks.size(),