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 16 namespace llvm { 17 class raw_ostream; 18 } 19 20 namespace clang { 21 class DiagnosticConsumer; 22 class DiagnosticsEngine; 23 class DiagnosticOptions; 24 25 namespace serialized_diags { 26 27 enum 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 37 enum 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 /// \brief Returns a DiagnosticConsumer that serializes diagnostics to 50 /// a bitcode file. 51 /// 52 /// The created DiagnosticConsumer is designed for quick and lightweight 53 /// transfer of of diagnostics to the enclosing build system (e.g., an IDE). 54 /// This allows wrapper tools for Clang to get diagnostics from Clang 55 /// (via libclang) without needing to parse Clang's command line output. 56 /// 57 DiagnosticConsumer *create(raw_ostream *OS, 58 DiagnosticOptions *diags); 59 60 } // end serialized_diags namespace 61 } // end clang namespace 62 63 #endif 64