aboutsummaryrefslogtreecommitdiff
path: root/clang/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
commit669a25aec3a815850a1587d345f6617fff9794c1 (patch)
treec7995a0293ded2a43f0f017f86db510c013fc945 /clang/lib/Sema/CodeCompleteConsumer.cpp
parentbc15eb1736b0bc87e36df432463885c8c674585d (diff)
downloadllvm-669a25aec3a815850a1587d345f6617fff9794c1.zip
llvm-669a25aec3a815850a1587d345f6617fff9794c1.tar.gz
llvm-669a25aec3a815850a1587d345f6617fff9794c1.tar.bz2
Implement code completion results for the Objective-C Key-Value Coding
(KVC) and Key-Value Observing (KVO) protocols. llvm-svn: 125696
Diffstat (limited to 'clang/lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r--clang/lib/Sema/CodeCompleteConsumer.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp
index cb2dd23..253c10e 100644
--- a/clang/lib/Sema/CodeCompleteConsumer.cpp
+++ b/clang/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(),