blob: 633f29edbefefb9edb5be0883d15eadb51ca4481 [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"
Nate Begeman165b9542008-04-17 18:06:57 +000020#include "llvm/Support/Streams.h"
Reid Spencer5f016e22007-07-11 17:01:13 +000021
22namespace clang {
23class SourceManager;
24
25class TextDiagnosticPrinter : public TextDiagnostics {
Ted Kremenek9c728dc2007-12-12 22:39:36 +000026 FullSourceLoc LastWarningLoc;
Steve Naroffefe7f362008-02-08 22:06:17 +000027 FullSourceLoc LastLoc;
Nate Begeman165b9542008-04-17 18:06:57 +000028 llvm::OStream OS;
Reid Spencer5f016e22007-07-11 17:01:13 +000029public:
Nate Begeman165b9542008-04-17 18:06:57 +000030 TextDiagnosticPrinter(llvm::OStream &os = llvm::cerr) : OS(os) {}
Reid Spencer5f016e22007-07-11 17:01:13 +000031
Ted Kremenek9c728dc2007-12-12 22:39:36 +000032 void PrintIncludeStack(FullSourceLoc Pos);
33
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000034 void HighlightRange(const SourceRange &R,
Ted Kremenek9c728dc2007-12-12 22:39:36 +000035 SourceManager& SrcMgr,
Chris Lattnere41b7cd2008-01-12 06:43:35 +000036 unsigned LineNo, unsigned FileID,
Reid Spencer5f016e22007-07-11 17:01:13 +000037 std::string &CaratLine,
38 const std::string &SourceLine);
Reid Spencer5f016e22007-07-11 17:01:13 +000039
Ted Kremenek9c728dc2007-12-12 22:39:36 +000040 virtual void HandleDiagnostic(Diagnostic &Diags,
41 Diagnostic::Level DiagLevel,
42 FullSourceLoc Pos,
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000043 diag::kind ID,
Ted Kremenek7a9d49f2007-12-11 21:27:55 +000044 const std::string *Strs,
Reid Spencer5f016e22007-07-11 17:01:13 +000045 unsigned NumStrs,
46 const SourceRange *Ranges,
47 unsigned NumRanges);
48};
49
50} // end namspace clang
51
52#endif