1//===--- SerializedDiagnosticPrinter.h - Serializer for diagnostics -------===// 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#ifndef LLVM_CLANG_FRONTEND_SERIALIZE_DIAGNOSTIC_PRINTER_H_ 11#define LLVM_CLANG_FRONTEND_SERIALIZE_DIAGNOSTIC_PRINTER_H_ 12 13#include "clang/Basic/LLVM.h" 14#include "llvm/Bitcode/BitstreamWriter.h" 15 16namespace llvm { 17class raw_ostream; 18} 19 20namespace clang { 21class DiagnosticConsumer; 22class DiagnosticsEngine; 23class DiagnosticOptions; 24 25namespace serialized_diags { 26 27enum BlockIDs { 28 /// \brief A top-level block which represents any meta data associated 29 /// with the diagostics, including versioning of the format. 30 BLOCK_META = llvm::bitc::FIRST_APPLICATION_BLOCKID, 31 32 /// \brief The this block acts as a container for all the information 33 /// for a specific diagnostic. 34 BLOCK_DIAG 35}; 36 37enum RecordIDs { 38 RECORD_VERSION = 1, 39 RECORD_DIAG, 40 RECORD_SOURCE_RANGE, 41 RECORD_DIAG_FLAG, 42 RECORD_CATEGORY, 43 RECORD_FILENAME, 44 RECORD_FIXIT, 45 RECORD_FIRST = RECORD_VERSION, 46 RECORD_LAST = RECORD_FIXIT 47}; 48 49/// A stable version of DiagnosticIDs::Level. 50/// 51/// Do not change the order of values in this enum, and please increment the 52/// serialized diagnostics version number when you add to it. 53enum Level { 54 Ignored = 0, 55 Note, 56 Warning, 57 Error, 58 Fatal, 59 Remark 60}; 61 62/// \brief Returns a DiagnosticConsumer that serializes diagnostics to 63/// a bitcode file. 64/// 65/// The created DiagnosticConsumer is designed for quick and lightweight 66/// transfer of of diagnostics to the enclosing build system (e.g., an IDE). 67/// This allows wrapper tools for Clang to get diagnostics from Clang 68/// (via libclang) without needing to parse Clang's command line output. 69/// 70DiagnosticConsumer *create(raw_ostream *OS, 71 DiagnosticOptions *diags); 72 73} // end serialized_diags namespace 74} // end clang namespace 75 76#endif 77