Switch the remaining diagnostic printing in CIndex over to the
diagnostic callback mechanism, so all diagnostics now go through that
callback. Also, eliminate the displayDiagnostics flag to
clang_createIndex(), since it is no longer necessary: the client
determines whether to display diagnostics or not.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94714 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 39c3446..d4bc008 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -411,8 +411,7 @@
CXIndex Idx;
CXTranslationUnit TU;
Idx = clang_createIndex(/* excludeDeclsFromPCH */
- !strcmp(filter, "local") ? 1 : 0,
- /* displayDiagnostics */ 1);
+ !strcmp(filter, "local") ? 1 : 0);
if (!CreateTranslationUnit(Idx, file, &TU))
return 1;
@@ -432,8 +431,7 @@
int result;
Idx = clang_createIndex(/* excludeDeclsFromPCH */
- !strcmp(filter, "local") ? 1 : 0,
- /* displayDiagnostics */ 1);
+ !strcmp(filter, "local") ? 1 : 0);
if (UseExternalASTs && strlen(UseExternalASTs))
clang_setUseExternalASTGeneration(Idx, 1);
@@ -487,8 +485,7 @@
unsigned start_line, start_col, last_line, last_col;
size_t i;
- if (!(Idx = clang_createIndex(/* excludeDeclsFromPCH */ 1,
- /* displayDiagnostics */ 1))) {
+ if (!(Idx = clang_createIndex(/* excludeDeclsFromPCH */ 1))) {
fprintf(stderr, "Could not create Index\n");
return 1;
}
@@ -700,12 +697,14 @@
if (parse_remapped_files(argc, argv, 2, &unsaved_files, &num_unsaved_files))
return -1;
- CIdx = clang_createIndex(0, 0);
+ CIdx = clang_createIndex(0);
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);
+ filename, line, column,
+ PrintDiagnosticCallback, stderr);
+
if (results) {
unsigned i, n = results->NumResults;
for (i = 0; i != n; ++i)
@@ -757,7 +756,7 @@
&num_unsaved_files))
return -1;
- CIdx = clang_createIndex(0, 1);
+ CIdx = clang_createIndex(0);
TU = clang_createTranslationUnitFromSourceFile(CIdx, argv[argc - 1],
argc - num_unsaved_files - 2 - NumLocations,
argv + num_unsaved_files + 1 + NumLocations,
@@ -816,7 +815,7 @@
if (parse_remapped_files(argc, argv, 2, &unsaved_files, &num_unsaved_files))
return -1;
- CIdx = clang_createIndex(0, 0);
+ CIdx = clang_createIndex(0);
TU = clang_createTranslationUnitFromSourceFile(CIdx, argv[argc - 1],
argc - num_unsaved_files - 3,
argv + num_unsaved_files + 2,