summaryrefslogtreecommitdiffstats
path: root/clang/include/clang-c/Index.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include/clang-c/Index.h')
-rw-r--r--clang/include/clang-c/Index.h58
1 files changed, 41 insertions, 17 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 0c671048dcd..99c129b2208 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -416,17 +416,27 @@ enum CXFixItKind {
typedef void *CXDiagnostic;
/**
- * \brief Callback function invoked for each diagnostic emitted during
- * translation.
+ * \brief Determine the number of diagnostics produced for the given
+ * translation unit.
+ */
+CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);
+
+/**
+ * \brief Retrieve a diagnostic associated with the given translation unit.
*
- * \param Diagnostic the diagnostic emitted during translation. This
- * diagnostic pointer is only valid during the execution of the
- * callback.
+ * \param Unit the translation unit to query.
+ * \param Index the zero-based diagnostic number to retrieve.
*
- * \param ClientData the callback client data.
+ * \returns the requested diagnostic. This diagnostic must be freed
+ * via a call to \c clang_disposeDiagnostic().
*/
-typedef void (*CXDiagnosticCallback)(CXDiagnostic Diagnostic,
- CXClientData ClientData);
+CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
+ unsigned Index);
+
+/**
+ * \brief Destroy a diagnostic.
+ */
+CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
/**
* \brief Determine the severity of the given diagnostic.
@@ -600,17 +610,13 @@ CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(
int num_clang_command_line_args,
const char **clang_command_line_args,
unsigned num_unsaved_files,
- struct CXUnsavedFile *unsaved_files,
- CXDiagnosticCallback diag_callback,
- CXClientData diag_client_data);
+ struct CXUnsavedFile *unsaved_files);
/**
* \brief Create a translation unit from an AST file (-emit-ast).
*/
CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(CXIndex,
- const char *ast_filename,
- CXDiagnosticCallback diag_callback,
- CXClientData diag_client_data);
+ const char *ast_filename);
/**
* \brief Destroy the specified CXTranslationUnit object.
@@ -1625,9 +1631,7 @@ CXCodeCompleteResults *clang_codeComplete(CXIndex CIdx,
struct CXUnsavedFile *unsaved_files,
const char *complete_filename,
unsigned complete_line,
- unsigned complete_column,
- CXDiagnosticCallback diag_callback,
- CXClientData diag_client_data);
+ unsigned complete_column);
/**
* \brief Free the given set of code-completion results.
@@ -1636,6 +1640,26 @@ CINDEX_LINKAGE
void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
/**
+ * \brief Determine the number of diagnostics produced prior to the
+ * location where code completion was performed.
+ */
+CINDEX_LINKAGE
+unsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);
+
+/**
+ * \brief Retrieve a diagnostic associated with the given code completion.
+ *
+ * \param Result the code completion results to query.
+ * \param Index the zero-based diagnostic number to retrieve.
+ *
+ * \returns the requested diagnostic. This diagnostic must be freed
+ * via a call to \c clang_disposeDiagnostic().
+ */
+CINDEX_LINKAGE
+CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
+ unsigned Index);
+
+/**
* @}
*/
OpenPOWER on IntegriCloud