diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-02-16 09:31:36 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-02-16 09:31:36 +0000 |
| commit | ecb7e5c8afe929ee38155db94de6b084ec32a645 (patch) | |
| tree | 53010172e19c77ea447bcd89e117cda052ab52e0 /tools/CIndex/CIndexDiagnostic.h | |
| parent | 5044f5c816adfd5cba17f1adee1a10127296d0bf (diff) | |
Notes
Diffstat (limited to 'tools/CIndex/CIndexDiagnostic.h')
| -rw-r--r-- | tools/CIndex/CIndexDiagnostic.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tools/CIndex/CIndexDiagnostic.h b/tools/CIndex/CIndexDiagnostic.h new file mode 100644 index 000000000000..9f7ae51a1083 --- /dev/null +++ b/tools/CIndex/CIndexDiagnostic.h @@ -0,0 +1,66 @@ +/*===-- CIndexDiagnostic.h - Diagnostics C Interface ------------*- C++ -*-===*\ +|* *| +|* The LLVM Compiler Infrastructure *| +|* *| +|* This file is distributed under the University of Illinois Open Source *| +|* License. See LICENSE.TXT for details. *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* Implements the diagnostic functions of the Clang C interface. *| +|* *| +\*===----------------------------------------------------------------------===*/ +#ifndef LLVM_CLANG_CINDEX_DIAGNOSTIC_H +#define LLVM_CLANG_CINDEX_DIAGNOSTIC_H + +#include "clang-c/Index.h" +#include "clang/Basic/Diagnostic.h" +#include "clang/Basic/LangOptions.h" + +namespace llvm { namespace sys { +class Path; +} } + +namespace clang { + +class Diagnostic; +class LangOptions; +class Preprocessor; + +/** + * \brief Diagnostic client that translates Clang diagnostics into diagnostics + * for the C interface to Clang. + */ +class CIndexDiagnosticClient : public DiagnosticClient { + CXDiagnosticCallback Callback; + CXClientData ClientData; + const LangOptions *LangOptsPtr; + +public: + CIndexDiagnosticClient(CXDiagnosticCallback Callback, + CXClientData ClientData) + : Callback(Callback), ClientData(ClientData), LangOptsPtr(0) { } + + virtual ~CIndexDiagnosticClient(); + + virtual void BeginSourceFile(const LangOptions &LangOpts, + const Preprocessor *PP); + + virtual void EndSourceFile(); + + virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, + const DiagnosticInfo &Info); +}; + +/// \brief Given the path to a file that contains binary, serialized +/// diagnostics produced by Clang, emit those diagnostics via the +/// given diagnostic engine. +void ReportSerializedDiagnostics(const llvm::sys::Path &DiagnosticsPath, + Diagnostic &Diags, + unsigned num_unsaved_files, + struct CXUnsavedFile *unsaved_files, + const LangOptions &LangOpts); + +} // end namespace clang + +#endif // LLVM_CLANG_CINDEX_DIAGNOSTIC_H |
