1 //===- llvm/Support/DiagnosticInfo.cpp - Diagnostic Definitions -*- 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 defines a diagnostic printer relying on raw_ostream.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/ADT/Twine.h"
15 #include "llvm/IR/DiagnosticPrinter.h"
16 #include "llvm/IR/Module.h"
17 #include "llvm/IR/Value.h"
18 #include "llvm/Support/raw_ostream.h"
19 #include "llvm/Support/SourceMgr.h"
23 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(char C) {
28 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned char C) {
33 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(signed char C) {
38 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(StringRef Str) {
43 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const char *Str) {
48 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(
49 const std::string &Str) {
54 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned long N) {
58 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long N) {
63 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(
64 unsigned long long N) {
69 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long long N) {
74 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const void *P) {
79 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned int N) {
84 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(int N) {
89 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(double N) {
94 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Twine &Str) {
100 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Value &V) {
101 Stream << V.getName();
105 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Module &M) {
106 Stream << M.getModuleIdentifier();
111 DiagnosticPrinter &DiagnosticPrinterRawOStream::
112 operator<<(const SMDiagnostic &Diag) {
113 // We don't have to print the SMDiagnostic kind, as the diagnostic severity
114 // is printed by the diagnostic handler.
115 Diag.print("", Stream, /*ShowColors=*/true, /*ShowKindLabel=*/false);