Convert clang_getCompletionChunkText() to return a CXString.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96439 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndexCodeCompletion.cpp b/tools/CIndex/CIndexCodeCompletion.cpp
index 4e41c5f..4912fef 100644
--- a/tools/CIndex/CIndexCodeCompletion.cpp
+++ b/tools/CIndex/CIndexCodeCompletion.cpp
@@ -21,6 +21,7 @@
#include "llvm/System/Program.h"
using namespace clang;
+using namespace clang::cxstring;
extern "C" {
@@ -80,11 +81,11 @@
return CXCompletionChunk_Text;
}
-const char *clang_getCompletionChunkText(CXCompletionString completion_string,
- unsigned chunk_number) {
+CXString clang_getCompletionChunkText(CXCompletionString completion_string,
+ unsigned chunk_number) {
CodeCompletionString *CCStr = (CodeCompletionString *)completion_string;
if (!CCStr || chunk_number >= CCStr->size())
- return 0;
+ return createCXString(0);
switch ((*CCStr)[chunk_number].Kind) {
case CodeCompletionString::CK_TypedText:
@@ -107,17 +108,18 @@
case CodeCompletionString::CK_Equal:
case CodeCompletionString::CK_HorizontalSpace:
case CodeCompletionString::CK_VerticalSpace:
- return (*CCStr)[chunk_number].Text;
+ return createCXString((*CCStr)[chunk_number].Text, false);
case CodeCompletionString::CK_Optional:
// Note: treated as an empty text block.
- return "";
+ return createCXString("");
}
// Should be unreachable, but let's be careful.
- return 0;
+ return createCXString(0);
}
+
CXCompletionString
clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
unsigned chunk_number) {