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/SourceLocation.h"
26 class DiagnosticOptions;
30 class TextDiagnosticPrinter : public DiagnosticClient {
31 llvm::raw_ostream &OS;
32 const LangOptions *LangOpts;
33 const DiagnosticOptions *DiagOpts;
35 SourceLocation LastWarningLoc;
36 FullSourceLoc LastLoc;
37 bool LastCaretDiagnosticWasNote;
40 TextDiagnosticPrinter(llvm::raw_ostream &os, const DiagnosticOptions &diags);
42 void BeginSourceFile(const LangOptions &LO) {
46 void EndSourceFile() {
50 void PrintIncludeStack(SourceLocation Loc, const SourceManager &SM);
52 void HighlightRange(const SourceRange &R,
53 const SourceManager &SrcMgr,
54 unsigned LineNo, FileID FID,
55 std::string &CaretLine,
56 const std::string &SourceLine);
58 void EmitCaretDiagnostic(SourceLocation Loc,
59 SourceRange *Ranges, unsigned NumRanges,
61 const CodeModificationHint *Hints,
65 virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
66 const DiagnosticInfo &Info);
69 } // end namspace clang