1193326Sed//===--- TextDiagnosticPrinter.h - Text Diagnostic Client -------*- C++ -*-===// 2193326Sed// 3193326Sed// The LLVM Compiler Infrastructure 4193326Sed// 5193326Sed// This file is distributed under the University of Illinois Open Source 6193326Sed// License. See LICENSE.TXT for details. 7193326Sed// 8193326Sed//===----------------------------------------------------------------------===// 9193326Sed// 10193326Sed// This is a concrete diagnostic client, which prints the diagnostics to 11193326Sed// standard error. 12193326Sed// 13193326Sed//===----------------------------------------------------------------------===// 14193326Sed 15193326Sed#ifndef LLVM_CLANG_FRONTEND_TEXT_DIAGNOSTIC_PRINTER_H_ 16193326Sed#define LLVM_CLANG_FRONTEND_TEXT_DIAGNOSTIC_PRINTER_H_ 17193326Sed 18193326Sed#include "clang/Basic/Diagnostic.h" 19234353Sdim#include "clang/Basic/LLVM.h" 20249423Sdim#include "llvm/ADT/IntrusiveRefCntPtr.h" 21234353Sdim#include "llvm/ADT/OwningPtr.h" 22193326Sed 23193326Sednamespace clang { 24198893Srdivackyclass DiagnosticOptions; 25198893Srdivackyclass LangOptions; 26234353Sdimclass TextDiagnostic; 27193326Sed 28226633Sdimclass TextDiagnosticPrinter : public DiagnosticConsumer { 29226633Sdim raw_ostream &OS; 30249423Sdim IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts; 31198893Srdivacky 32234353Sdim /// \brief Handle to the currently active text diagnostic emitter. 33234353Sdim OwningPtr<TextDiagnostic> TextDiag; 34193326Sed 35204643Srdivacky /// A string to prefix to error messages. 36204643Srdivacky std::string Prefix; 37204643Srdivacky 38234353Sdim unsigned OwnsOutputStream : 1; 39234353Sdim 40193326Sedpublic: 41243830Sdim TextDiagnosticPrinter(raw_ostream &os, DiagnosticOptions *diags, 42199482Srdivacky bool OwnsOutputStream = false); 43199482Srdivacky virtual ~TextDiagnosticPrinter(); 44193326Sed 45204643Srdivacky /// setPrefix - Set the diagnostic printer prefix string, which will be 46204643Srdivacky /// printed at the start of any diagnostics. If empty, no prefix string is 47204643Srdivacky /// used. 48204643Srdivacky void setPrefix(std::string Value) { Prefix = Value; } 49204643Srdivacky 50234353Sdim void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP); 51234353Sdim void EndSourceFile(); 52234353Sdim void HandleDiagnostic(DiagnosticsEngine::Level Level, const Diagnostic &Info); 53193326Sed}; 54193326Sed 55207632Srdivacky} // end namespace clang 56193326Sed 57193326Sed#endif 58