Revert " [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (#107432)"
[llvm-project.git] / llvm / lib / IR / DiagnosticPrinter.cpp
blob49b8bbae53be9e998f6947106c7274e634e03964
1 //===- llvm/IR/DiagnosticPrinter.cpp - Diagnostic Printer -------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
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"
20 using namespace llvm;
22 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(char C) {
23 Stream << C;
24 return *this;
27 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned char C) {
28 Stream << C;
29 return *this;
32 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(signed char C) {
33 Stream << C;
34 return *this;
37 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(StringRef Str) {
38 Stream << Str;
39 return *this;
42 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const char *Str) {
43 Stream << Str;
44 return *this;
47 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(
48 const std::string &Str) {
49 Stream << Str;
50 return *this;
53 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned long N) {
54 Stream << N;
55 return *this;
57 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long N) {
58 Stream << N;
59 return *this;
62 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(
63 unsigned long long N) {
64 Stream << N;
65 return *this;
68 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long long N) {
69 Stream << N;
70 return *this;
73 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const void *P) {
74 Stream << P;
75 return *this;
78 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned int N) {
79 Stream << N;
80 return *this;
83 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(int N) {
84 Stream << N;
85 return *this;
88 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(double N) {
89 Stream << N;
90 return *this;
93 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Twine &Str) {
94 Str.print(Stream);
95 return *this;
98 // IR related types.
99 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Value &V) {
100 Stream << V.getName();
101 return *this;
104 DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Module &M) {
105 Stream << M.getModuleIdentifier();
106 return *this;
109 // Other types.
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);
115 return *this;