LLVM 19.0.0git
DiagnosticPrinter.cpp
Go to the documentation of this file.
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.
10//
11//===----------------------------------------------------------------------===//
12
14#include "llvm/ADT/Twine.h"
15#include "llvm/IR/Module.h"
16#include "llvm/IR/Value.h"
19
20using namespace llvm;
21
23 Stream << C;
24 return *this;
25}
26
28 Stream << C;
29 return *this;
30}
31
33 Stream << C;
34 return *this;
35}
36
38 Stream << Str;
39 return *this;
40}
41
43 Stream << Str;
44 return *this;
45}
46
48 const std::string &Str) {
49 Stream << Str;
50 return *this;
51}
52
54 Stream << N;
55 return *this;
56}
58 Stream << N;
59 return *this;
60}
61
63 unsigned long long N) {
64 Stream << N;
65 return *this;
66}
67
69 Stream << N;
70 return *this;
71}
72
74 Stream << P;
75 return *this;
76}
77
79 Stream << N;
80 return *this;
81}
82
84 Stream << N;
85 return *this;
86}
87
89 Stream << N;
90 return *this;
91}
92
94 Str.print(Stream);
95 return *this;
96}
97
98// IR related types.
100 Stream << V.getName();
101 return *this;
102}
103
105 Stream << M.getModuleIdentifier();
106 return *this;
107}
108
109// Other types.
111operator<<(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;
116}
Module.h This file contains the declarations for the Module class.
#define P(N)
DiagnosticPrinter & operator<<(char C) override
Interface for custom diagnostic printing.
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:281
void print(const char *ProgName, raw_ostream &S, bool ShowColors=true, bool ShowKindLabel=true) const
Definition: SourceMgr.cpp:484
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
LLVM Value Representation.
Definition: Value.h:74
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
#define N