summaryrefslogtreecommitdiffstats
path: root/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:34:51 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-01-01 10:34:51 +0000
commitbb1e3bc1e0be2b8f891db46457a8943451bf4d8b (patch)
tree1e68501209c9133fbda8d45171e59f8d6f12dd55 /tools/c-index-test/c-index-test.c
parent77212133072dc40f070a280af8217032f55a9eb4 (diff)
downloadFreeBSD-src-bb1e3bc1e0be2b8f891db46457a8943451bf4d8b.zip
FreeBSD-src-bb1e3bc1e0be2b8f891db46457a8943451bf4d8b.tar.gz
Updaet clang to 92395.
Diffstat (limited to 'tools/c-index-test/c-index-test.c')
-rw-r--r--tools/c-index-test/c-index-test.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 7300585..33013f3 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -355,6 +355,7 @@ clang_getCompletionChunkKindSpelling(enum CXCompletionChunkKind Kind) {
case CXCompletionChunk_LeftAngle: return "LeftAngle";
case CXCompletionChunk_RightAngle: return "RightAngle";
case CXCompletionChunk_Comma: return "Comma";
+ case CXCompletionChunk_ResultType: return "ResultType";
}
return "Unknown";
@@ -461,7 +462,15 @@ int parse_remapped_files(int argc, const char **argv, int start_arg,
/* Read the contents of the file we're remapping to. */
contents = (char *)malloc(unsaved->Length + 1);
- fread(contents, 1, unsaved->Length, to_file);
+ if (fread(contents, 1, unsaved->Length, to_file) != unsaved->Length) {
+ fprintf(stderr, "error: unexpected %s reading 'to' file %s\n",
+ (feof(to_file) ? "EOF" : "error"), semi + 1);
+ fclose(to_file);
+ free_remapped_files(*unsaved_files, i);
+ *unsaved_files = 0;
+ *num_unsaved_files = 0;
+ return -1;
+ }
contents[unsaved->Length] = 0;
unsaved->Contents = contents;
@@ -488,6 +497,7 @@ int perform_code_completion(int argc, const char **argv) {
int errorCode;
struct CXUnsavedFile *unsaved_files = 0;
int num_unsaved_files = 0;
+ CXCodeCompleteResults *results = 0;
input += strlen("-code-completion-at=");
if ((errorCode = parse_file_line_column(input, &filename, &line, &column)))
@@ -497,10 +507,18 @@ int perform_code_completion(int argc, const char **argv) {
return -1;
CIdx = clang_createIndex(0, 0);
- clang_codeComplete(CIdx, argv[argc - 1], argc - num_unsaved_files - 3,
- argv + num_unsaved_files + 2,
- num_unsaved_files, unsaved_files,
- filename, line, column, &print_completion_result, stdout);
+ results = clang_codeComplete(CIdx,
+ argv[argc - 1], argc - num_unsaved_files - 3,
+ argv + num_unsaved_files + 2,
+ num_unsaved_files, unsaved_files,
+ filename, line, column);
+ if (results) {
+ unsigned i, n = results->NumResults;
+ for (i = 0; i != n; ++i)
+ print_completion_result(results->Results + i, stdout);
+ clang_disposeCodeCompleteResults(results);
+ }
+
clang_disposeIndex(CIdx);
free(filename);
OpenPOWER on IntegriCloud