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.
llvm-svn: 94714
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index e26dff1..d9b4b09 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -143,13 +143,10 @@
* header that was used by the translation unit. If zero, all declarations
* will be enumerated.
*
- * - displayDiagnostics: when non-zero, diagnostics will be output. If zero,
- * diagnostics will be ignored.
- *
* Here is an example:
*
- * // excludeDeclsFromPCH = 1, displayDiagnostics = 1
- * Idx = clang_createIndex(1, 1);
+ * // excludeDeclsFromPCH = 1
+ * Idx = clang_createIndex(1);
*
* // IndexTest.pch was produced with the following command:
* // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
@@ -173,8 +170,7 @@
* -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
* (which gives the indexer the same performance benefit as the compiler).
*/
-CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
- int displayDiagnostics);
+CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH);
CINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
/**
@@ -1593,6 +1589,13 @@
* Note that the column should point just after the syntactic construct that
* initiated code completion, and not in the middle of a lexical token.
*
+ * \param diag_callback callback function that will receive any diagnostics
+ * emitted while processing this source file. If NULL, diagnostics will be
+ * suppressed.
+ *
+ * \param diag_client_data client data that will be passed to the diagnostic
+ * callback function.
+ *
* \returns if successful, a new CXCodeCompleteResults structure
* containing code-completion results, which should eventually be
* freed with \c clang_disposeCodeCompleteResults(). If code
@@ -1607,7 +1610,9 @@
struct CXUnsavedFile *unsaved_files,
const char *complete_filename,
unsigned complete_line,
- unsigned complete_column);
+ unsigned complete_column,
+ CXDiagnosticCallback diag_callback,
+ CXClientData diag_client_data);
/**
* \brief Free the given set of code-completion results.