blob: faf1b412b2c116cb4fe8e5363fbc4d4f8299f810 [file] [log] [blame]
Chris Lattner4b009652007-07-25 00:24:17 +00001//===--- TextDiagnostics.h - Text Diagnostics Checkers ----------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Bill Wendling and is distributed under the
6// University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This is the parent class for all text diagnostics.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef TEXT_DIAGNOSTICS_H_
15#define TEXT_DIAGNOSTICS_H_
16
17#include "clang/Basic/Diagnostic.h"
18
19namespace clang {
20class SourceManager;
21class HeaderSearch;
22class Preprocessor;
23
24class TextDiagnostics : public DiagnosticClient {
25 HeaderSearch *TheHeaderSearch;
26protected:
27 SourceManager &SourceMgr;
28 Preprocessor *ThePreprocessor;
29
30 std::string FormatDiagnostic(Diagnostic::Level Level,
31 diag::kind ID,
32 const std::string *Strs,
33 unsigned NumStrs);
34public:
35 TextDiagnostics(SourceManager &sourceMgr) : SourceMgr(sourceMgr) {}
36 virtual ~TextDiagnostics();
37
38 void setHeaderSearch(HeaderSearch &HS) { TheHeaderSearch = &HS; }
39 void setPreprocessor(Preprocessor &P) { ThePreprocessor = &P; }
40
41 virtual bool IgnoreDiagnostic(Diagnostic::Level Level,
42 SourceLocation Pos);
43 virtual void HandleDiagnostic(Diagnostic::Level DiagLevel,
44 SourceLocation Pos,
45 diag::kind ID, const std::string *Strs,
46 unsigned NumStrs,
47 const SourceRange *Ranges,
48 unsigned NumRanges) = 0;
49};
50
51} // end namspace clang
52
53#endif