Quentin Colombet | b4c44d2 | 2013-12-17 17:47:22 +0000 | [diff] [blame] | 1 | //===- llvm/Support/DiagnosticInfo.cpp - Diagnostic Definitions -*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines the a diagnostic printer relying on raw_ostream. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "llvm/ADT/Twine.h" |
| 15 | #include "llvm/IR/DiagnosticPrinter.h" |
| 16 | #include "llvm/IR/Value.h" |
| 17 | #include "llvm/Support/raw_ostream.h" |
| 18 | |
| 19 | using namespace llvm; |
| 20 | |
| 21 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(char C) { |
| 22 | Stream << C; |
| 23 | return *this; |
| 24 | } |
| 25 | |
| 26 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned char C) { |
| 27 | Stream << C; |
| 28 | return *this; |
| 29 | } |
| 30 | |
| 31 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(signed char C) { |
| 32 | Stream << C; |
| 33 | return *this; |
| 34 | } |
| 35 | |
| 36 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(StringRef Str) { |
| 37 | Stream << Str; |
| 38 | return *this; |
| 39 | } |
| 40 | |
| 41 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const char *Str) { |
| 42 | Stream << Str; |
| 43 | return *this; |
| 44 | } |
| 45 | |
| 46 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<( |
| 47 | const std::string &Str) { |
| 48 | Stream << Str; |
| 49 | return *this; |
| 50 | } |
| 51 | |
| 52 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned long N) { |
| 53 | Stream << N; |
| 54 | return *this; |
| 55 | } |
| 56 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long N) { |
| 57 | Stream << N; |
| 58 | return *this; |
| 59 | } |
| 60 | |
| 61 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<( |
| 62 | unsigned long long N) { |
| 63 | Stream << N; |
| 64 | return *this; |
| 65 | } |
| 66 | |
| 67 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long long N) { |
| 68 | Stream << N; |
| 69 | return *this; |
| 70 | } |
| 71 | |
| 72 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const void *P) { |
| 73 | Stream << P; |
| 74 | return *this; |
| 75 | } |
| 76 | |
| 77 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned int N) { |
| 78 | Stream << N; |
| 79 | return *this; |
| 80 | } |
| 81 | |
| 82 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(int N) { |
| 83 | Stream << N; |
| 84 | return *this; |
| 85 | } |
| 86 | |
| 87 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(double N) { |
| 88 | Stream << N; |
| 89 | return *this; |
| 90 | } |
| 91 | |
| 92 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Twine &Str) { |
Quentin Colombet | 98e79a0 | 2013-12-17 22:35:07 +0000 | [diff] [blame] | 93 | Str.print(Stream); |
Quentin Colombet | b4c44d2 | 2013-12-17 17:47:22 +0000 | [diff] [blame] | 94 | return *this; |
| 95 | } |
| 96 | |
| 97 | // IR related types. |
| 98 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Value &V) { |
| 99 | Stream << V.getName(); |
| 100 | return *this; |
| 101 | } |