1234287Sdim//===--- SerializedDiagnosticPrinter.h - Serializer for diagnostics -------===//
2234287Sdim//
3234287Sdim//                     The LLVM Compiler Infrastructure
4234287Sdim//
5234287Sdim// This file is distributed under the University of Illinois Open Source
6234287Sdim// License. See LICENSE.TXT for details.
7234287Sdim//
8234287Sdim//===----------------------------------------------------------------------===//
9234287Sdim
10234287Sdim#ifndef LLVM_CLANG_FRONTEND_SERIALIZE_DIAGNOSTIC_PRINTER_H_
11234287Sdim#define LLVM_CLANG_FRONTEND_SERIALIZE_DIAGNOSTIC_PRINTER_H_
12234287Sdim
13249423Sdim#include "clang/Basic/LLVM.h"
14234287Sdim#include "llvm/Bitcode/BitstreamWriter.h"
15234287Sdim
16234287Sdimnamespace llvm {
17234287Sdimclass raw_ostream;
18234287Sdim}
19234287Sdim
20234287Sdimnamespace clang {
21234287Sdimclass DiagnosticConsumer;
22234287Sdimclass DiagnosticsEngine;
23234287Sdimclass DiagnosticOptions;
24234287Sdim
25234287Sdimnamespace serialized_diags {
26234287Sdim
27234287Sdimenum BlockIDs {
28234287Sdim  /// \brief A top-level block which represents any meta data associated
29234287Sdim  /// with the diagostics, including versioning of the format.
30234287Sdim  BLOCK_META = llvm::bitc::FIRST_APPLICATION_BLOCKID,
31234287Sdim
32234287Sdim  /// \brief The this block acts as a container for all the information
33234287Sdim  /// for a specific diagnostic.
34234287Sdim  BLOCK_DIAG
35234287Sdim};
36234287Sdim
37234287Sdimenum RecordIDs {
38234287Sdim  RECORD_VERSION = 1,
39234287Sdim  RECORD_DIAG,
40234287Sdim  RECORD_SOURCE_RANGE,
41234287Sdim  RECORD_DIAG_FLAG,
42234287Sdim  RECORD_CATEGORY,
43234287Sdim  RECORD_FILENAME,
44234287Sdim  RECORD_FIXIT,
45234287Sdim  RECORD_FIRST = RECORD_VERSION,
46234287Sdim  RECORD_LAST = RECORD_FIXIT
47234287Sdim};
48234287Sdim
49234287Sdim/// \brief Returns a DiagnosticConsumer that serializes diagnostics to
50234287Sdim///  a bitcode file.
51234287Sdim///
52234287Sdim/// The created DiagnosticConsumer is designed for quick and lightweight
53234287Sdim/// transfer of of diagnostics to the enclosing build system (e.g., an IDE).
54234287Sdim/// This allows wrapper tools for Clang to get diagnostics from Clang
55234287Sdim/// (via libclang) without needing to parse Clang's command line output.
56234287Sdim///
57249423SdimDiagnosticConsumer *create(raw_ostream *OS,
58243830Sdim                           DiagnosticOptions *diags);
59234287Sdim
60234287Sdim} // end serialized_diags namespace
61234287Sdim} // end clang namespace
62234287Sdim
63234287Sdim#endif
64