Douglas Gregor | ac0605e | 2010-01-28 06:00:51 +0000 | [diff] [blame] | 1 | /*===-- CIndexDiagnostic.h - Diagnostics C Interface ------------*- C++ -*-===*\ |
Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 2 | |* *| |
| 3 | |* The LLVM Compiler Infrastructure *| |
| 4 | |* *| |
| 5 | |* This file is distributed under the University of Illinois Open Source *| |
| 6 | |* License. See LICENSE.TXT for details. *| |
| 7 | |* *| |
| 8 | |*===----------------------------------------------------------------------===*| |
| 9 | |* *| |
| 10 | |* Implements the diagnostic functions of the Clang C interface. *| |
| 11 | |* *| |
| 12 | \*===----------------------------------------------------------------------===*/ |
| 13 | #ifndef LLVM_CLANG_CINDEX_DIAGNOSTIC_H |
| 14 | #define LLVM_CLANG_CINDEX_DIAGNOSTIC_H |
| 15 | |
| 16 | #include "clang-c/Index.h" |
| 17 | #include "clang/Basic/Diagnostic.h" |
| 18 | #include "clang/Basic/LangOptions.h" |
| 19 | |
Douglas Gregor | ac0605e | 2010-01-28 06:00:51 +0000 | [diff] [blame] | 20 | namespace llvm { namespace sys { |
| 21 | class Path; |
| 22 | } } |
| 23 | |
Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 24 | namespace clang { |
| 25 | |
Douglas Gregor | ac0605e | 2010-01-28 06:00:51 +0000 | [diff] [blame] | 26 | class Diagnostic; |
Daniel Dunbar | 854d36b | 2010-01-30 23:31:40 +0000 | [diff] [blame^] | 27 | class LangOptions; |
Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 28 | class Preprocessor; |
| 29 | |
| 30 | /** |
| 31 | * \brief Diagnostic client that translates Clang diagnostics into diagnostics |
| 32 | * for the C interface to Clang. |
| 33 | */ |
| 34 | class CIndexDiagnosticClient : public DiagnosticClient { |
| 35 | CXDiagnosticCallback Callback; |
| 36 | CXClientData ClientData; |
| 37 | LangOptions LangOpts; |
| 38 | |
| 39 | public: |
| 40 | CIndexDiagnosticClient(CXDiagnosticCallback Callback, |
| 41 | CXClientData ClientData) |
| 42 | : Callback(Callback), ClientData(ClientData), LangOpts() { } |
| 43 | |
| 44 | virtual ~CIndexDiagnosticClient(); |
| 45 | |
| 46 | virtual void BeginSourceFile(const LangOptions &LangOpts, |
| 47 | const Preprocessor *PP); |
| 48 | |
| 49 | virtual void HandleDiagnostic(Diagnostic::Level DiagLevel, |
| 50 | const DiagnosticInfo &Info); |
| 51 | }; |
Douglas Gregor | ac0605e | 2010-01-28 06:00:51 +0000 | [diff] [blame] | 52 | |
| 53 | /// \brief Given the path to a file that contains binary, serialized |
| 54 | /// diagnostics produced by Clang, emit those diagnostics via the |
| 55 | /// given diagnostic engine. |
| 56 | void ReportSerializedDiagnostics(const llvm::sys::Path &DiagnosticsPath, |
| 57 | Diagnostic &Diags, |
| 58 | unsigned num_unsaved_files, |
Daniel Dunbar | 854d36b | 2010-01-30 23:31:40 +0000 | [diff] [blame^] | 59 | struct CXUnsavedFile *unsaved_files, |
| 60 | const LangOptions &LangOpts); |
Douglas Gregor | ac0605e | 2010-01-28 06:00:51 +0000 | [diff] [blame] | 61 | |
Douglas Gregor | 4f9c376 | 2010-01-28 00:27:43 +0000 | [diff] [blame] | 62 | } // end namespace clang |
| 63 | |
| 64 | #endif // LLVM_CLANG_CINDEX_DIAGNOSTIC_H |