blob: e9c2e3a2e5ef3ccdd97b1bc8e3c25a12ba7b6f5a [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===--- TextDiagnosticPrinter.h - Text Diagnostic Client -------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner0bc735f2007-12-29 19:59:25 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Reid Spencer5f016e22007-07-11 17:01:13 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This is a concrete diagnostic client, which prints the diagnostics to
11// standard error.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef TEXT_DIAGNOSTIC_PRINTER_H_
16#define TEXT_DIAGNOSTIC_PRINTER_H_
17
18#include "TextDiagnostics.h"
19#include "clang/Basic/SourceLocation.h"
20
21namespace clang {
22class SourceManager;
23
24class TextDiagnosticPrinter : public TextDiagnostics {
Ted Kremenek9c728dc2007-12-12 22:39:36 +000025 FullSourceLoc LastWarningLoc;
Steve Naroffefe7f362008-02-08 22:06:17 +000026 FullSourceLoc LastLoc;
Reid Spencer5f016e22007-07-11 17:01:13 +000027public:
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000028 TextDiagnosticPrinter() {}
Reid Spencer5f016e22007-07-11 17:01:13 +000029
Ted Kremenek9c728dc2007-12-12 22:39:36 +000030 void PrintIncludeStack(FullSourceLoc Pos);
31
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000032 void HighlightRange(const SourceRange &R,
Ted Kremenek9c728dc2007-12-12 22:39:36 +000033 SourceManager& SrcMgr,
Chris Lattnere41b7cd2008-01-12 06:43:35 +000034 unsigned LineNo, unsigned FileID,
Reid Spencer5f016e22007-07-11 17:01:13 +000035 std::string &CaratLine,
36 const std::string &SourceLine);
Reid Spencer5f016e22007-07-11 17:01:13 +000037
Ted Kremenek9c728dc2007-12-12 22:39:36 +000038 virtual void HandleDiagnostic(Diagnostic &Diags,
39 Diagnostic::Level DiagLevel,
40 FullSourceLoc Pos,
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000041 diag::kind ID,
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000042 const std::string *Strs,
Reid Spencer5f016e22007-07-11 17:01:13 +000043 unsigned NumStrs,
44 const SourceRange *Ranges,
45 unsigned NumRanges);
46};
47
48} // end namspace clang
49
50#endif