diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-11-10 08:43:12 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-11-10 08:43:12 +0000 |
commit | 153221717e39ce41323d5bc6b8b8bf130923c1bd (patch) | |
tree | aa784102b15aa3a56419986e7fc396c59f5143a6 /include/clang-c | |
parent | 1a343ebbf413e8eae6b2737b2b2d79cbf5765571 (diff) |
serialized diagnostics: implement full deserialization of clang diagnostics via the libclang API.
I've tested it on simple cases and it works. Test cases to follow as well as a few tweaks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144269 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang-c')
-rw-r--r-- | include/clang-c/Index.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 10fa53853a..941381d79e 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -522,6 +522,86 @@ enum CXDiagnosticSeverity { typedef void *CXDiagnostic; /** + * \brief A group of CXDiagnostics. + */ +typedef void *CXDiagnosticSet; + +/** + * \brief Determine the number of diagnostics in a CXDiagnosticSet. + */ +CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags); + +/** + * \brief Retrieve a diagnostic associated with the given CXDiagnosticSet. + * + * \param Unit the CXDiagnosticSet 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_getDiagnosticInSet(CXDiagnosticSet Diags, + unsigned Index); + + +/** + * \brief Describes the kind of error that occurred (if any) in a call to + * \c clang_loadDiagnostics. + */ +enum CXLoadDiag_Error { + /** + * \brief Indicates that no error occurred. + */ + CXLoadDiag_None = 0, + + /** + * \brief Indicates that an unknown error occurred while attempting to + * deserialize diagnostics. + */ + CXLoadDiag_Unknown = 1, + + /** + * \brief Indicates that the file containing the serialized diagnostics + * could not be opened. + */ + CXLoadDiag_CannotLoad = 2, + + /** + * \brief Indicates that the serialized diagnostics file is invalid or + * corrupt. + */ + CXLoadDiag_InvalidFile = 3 +}; + +/** + * \brief Deserialize a set of diagnostics from a Clang diagnostics bitcode + * file. + * + * \param The name of the file to deserialize. + * \param A pointer to a enum value recording if there was a problem + * deserializing the diagnostics. + * \param A pointer to a CXString for recording the error string + * if the file was not successfully loaded. + * + * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These + * diagnostics should be released using clang_disposeDiagnosticSet(). + */ +CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file, + enum CXLoadDiag_Error *error, + CXString *errorString); + +/** + * \brief Release a CXDiagnosticSet and all of its contained diagnostics. + */ +CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags); + +/** + * \brief Retrieve the child diagnostics of a CXDiagnostic. This + * CXDiagnosticSet does not need to be released by clang_diposeDiagnosticSet. + */ +CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D); + +/** * \brief Determine the number of diagnostics produced for the given * translation unit. */ |