1 //===- llvm/Support/DiagnosticPrinter.h - Diagnostic Printer ----*- 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 file declares the main interface for printer backend diagnostic.
12 // Clients of the backend diagnostics should overload this interface based
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_SUPPORT_DIAGNOSTICPRINTER_H
17 #define LLVM_SUPPORT_DIAGNOSTICPRINTER_H
22 // Forward declarations.
29 /// \brief Interface for custom diagnostic printing.
30 class DiagnosticPrinter {
32 virtual ~DiagnosticPrinter() {}
35 virtual DiagnosticPrinter &operator<<(char C) = 0;
36 virtual DiagnosticPrinter &operator<<(unsigned char C) = 0;
37 virtual DiagnosticPrinter &operator<<(signed char C) = 0;
38 virtual DiagnosticPrinter &operator<<(StringRef Str) = 0;
39 virtual DiagnosticPrinter &operator<<(const char *Str) = 0;
40 virtual DiagnosticPrinter &operator<<(const std::string &Str) = 0;
41 virtual DiagnosticPrinter &operator<<(unsigned long N) = 0;
42 virtual DiagnosticPrinter &operator<<(long N) = 0;
43 virtual DiagnosticPrinter &operator<<(unsigned long long N) = 0;
44 virtual DiagnosticPrinter &operator<<(long long N) = 0;
45 virtual DiagnosticPrinter &operator<<(const void *P) = 0;
46 virtual DiagnosticPrinter &operator<<(unsigned int N) = 0;
47 virtual DiagnosticPrinter &operator<<(int N) = 0;
48 virtual DiagnosticPrinter &operator<<(double N) = 0;
49 virtual DiagnosticPrinter &operator<<(const Twine &Str) = 0;
52 virtual DiagnosticPrinter &operator<<(const Value &V) = 0;
53 virtual DiagnosticPrinter &operator<<(const Module &M) = 0;
56 /// \brief Basic diagnostic printer that uses an underlying raw_ostream.
57 class DiagnosticPrinterRawOStream : public DiagnosticPrinter {
62 DiagnosticPrinterRawOStream(raw_ostream &Stream) : Stream(Stream) {};
65 virtual DiagnosticPrinter &operator<<(char C);
66 virtual DiagnosticPrinter &operator<<(unsigned char C);
67 virtual DiagnosticPrinter &operator<<(signed char C);
68 virtual DiagnosticPrinter &operator<<(StringRef Str);
69 virtual DiagnosticPrinter &operator<<(const char *Str);
70 virtual DiagnosticPrinter &operator<<(const std::string &Str);
71 virtual DiagnosticPrinter &operator<<(unsigned long N);
72 virtual DiagnosticPrinter &operator<<(long N);
73 virtual DiagnosticPrinter &operator<<(unsigned long long N);
74 virtual DiagnosticPrinter &operator<<(long long N);
75 virtual DiagnosticPrinter &operator<<(const void *P);
76 virtual DiagnosticPrinter &operator<<(unsigned int N);
77 virtual DiagnosticPrinter &operator<<(int N);
78 virtual DiagnosticPrinter &operator<<(double N);
79 virtual DiagnosticPrinter &operator<<(const Twine &Str);
82 virtual DiagnosticPrinter &operator<<(const Value &V);
83 virtual DiagnosticPrinter &operator<<(const Module &M);
85 } // End namespace llvm