aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/CodeCompleteConsumer.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-01 22:57:45 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-01 22:57:45 +0000
commitdae687575010c9c49a4b552f5eef82cd6279d9ac (patch)
tree761782a397e30df66392dd5c7218c412116d0b21 /lib/Sema/CodeCompleteConsumer.cpp
parentdaef9cc7e379c83e272f50de2fb3b7ab2e7e42db (diff)
Create a special allocator class for code completion, so that all of
the string copying goes through a single place that can have associated state. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124698 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r--lib/Sema/CodeCompleteConsumer.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp
index ddfe8b0b17..cb2dd234b4 100644
--- a/lib/Sema/CodeCompleteConsumer.cpp
+++ b/lib/Sema/CodeCompleteConsumer.cpp
@@ -220,6 +220,13 @@ const char *CodeCompletionString::getTypedText() const {
return 0;
}
+const char *CodeCompletionAllocator::CopyString(llvm::StringRef String) {
+ char *Mem = (char *)Allocate(String.size() + 1, 1);
+ std::copy(String.begin(), String.end(), Mem);
+ Mem[String.size()] = 0;
+ return Mem;
+}
+
CodeCompletionString *CodeCompletionBuilder::TakeString() {
void *Mem = Allocator.Allocate(
sizeof(CodeCompletionString) + sizeof(Chunk) * Chunks.size(),