1 //===--- TextDiagnosticPrinter.h - Text Diagnostic Client -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This is a concrete diagnostic client, which prints the diagnostics to
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_FRONTEND_TEXT_DIAGNOSTIC_PRINTER_H_
16 #define LLVM_CLANG_FRONTEND_TEXT_DIAGNOSTIC_PRINTER_H_
18 #include "clang/Basic/Diagnostic.h"
19 #include "clang/Basic/LLVM.h"
20 #include "llvm/ADT/OwningPtr.h"
23 class DiagnosticOptions;
27 class TextDiagnosticPrinter : public DiagnosticConsumer {
29 const LangOptions *LangOpts;
30 const DiagnosticOptions *DiagOpts;
31 const SourceManager *SM;
33 /// \brief Handle to the currently active text diagnostic emitter.
34 OwningPtr<TextDiagnostic> TextDiag;
36 /// A string to prefix to error messages.
39 unsigned OwnsOutputStream : 1;
42 TextDiagnosticPrinter(raw_ostream &os, const DiagnosticOptions &diags,
43 bool OwnsOutputStream = false);
44 virtual ~TextDiagnosticPrinter();
46 /// setPrefix - Set the diagnostic printer prefix string, which will be
47 /// printed at the start of any diagnostics. If empty, no prefix string is
49 void setPrefix(std::string Value) { Prefix = Value; }
51 void BeginSourceFile(const LangOptions &LO, const Preprocessor *PP);
53 void HandleDiagnostic(DiagnosticsEngine::Level Level, const Diagnostic &Info);
54 DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const;
57 } // end namespace clang