1 //===- llvm/Support/DiagnosticInfo.cpp - Diagnostic Definitions -*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines a diagnostic printer relying on raw_ostream.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/IR/DiagnosticPrinter.h"
14 #include "llvm/ADT/Twine.h"
15 #include "llvm/IR/Module.h"
16 #include "llvm/IR/Value.h"
17 #include "llvm/Support/SourceMgr.h"
18 #include "llvm/Support/raw_ostream.h"
22 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(char C
) {
27 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(unsigned char C
) {
32 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(signed char C
) {
37 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(StringRef Str
) {
42 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(const char *Str
) {
47 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(
48 const std::string
&Str
) {
53 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(unsigned long N
) {
57 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(long N
) {
62 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(
63 unsigned long long N
) {
68 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(long long N
) {
73 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(const void *P
) {
78 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(unsigned int N
) {
83 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(int N
) {
88 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(double N
) {
93 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(const Twine
&Str
) {
99 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(const Value
&V
) {
100 Stream
<< V
.getName();
104 DiagnosticPrinter
&DiagnosticPrinterRawOStream::operator<<(const Module
&M
) {
105 Stream
<< M
.getModuleIdentifier();
110 DiagnosticPrinter
&DiagnosticPrinterRawOStream::
111 operator<<(const SMDiagnostic
&Diag
) {
112 // We don't have to print the SMDiagnostic kind, as the diagnostic severity
113 // is printed by the diagnostic handler.
114 Diag
.print("", Stream
, /*ShowColors=*/true, /*ShowKindLabel=*/false);