LLVM  9.0.0svn
DiagnosticPrinter.cpp
Go to the documentation of this file.
1 //===- llvm/Support/DiagnosticInfo.cpp - Diagnostic Definitions -*- 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"
17 #include "llvm/Support/SourceMgr.h"
19 
20 using 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 
106  return *this;
107 }
108 
109 // Other types.
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;
116 }
uint64_t CallInst * C
This class represents lattice values for constants.
Definition: AllocatorList.h:23
void print(const char *ProgName, raw_ostream &S, bool ShowColors=true, bool ShowKindLabel=true) const
Definition: SourceMgr.cpp:373
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
Interface for custom diagnostic printing.
DiagnosticPrinter & operator<<(char C) override
#define P(N)
const std::string & getModuleIdentifier() const
Get the module identifier which is, essentially, the name of the module.
Definition: Module.h:210
Module.h This file contains the declarations for the Module class.
StringRef getName() const
Return a constant reference to the value&#39;s name.
Definition: Value.cpp:214
#define N
LLVM Value Representation.
Definition: Value.h:72
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
void print(raw_ostream &OS) const
Write the concatenated string represented by this twine to the stream OS.
Definition: Twine.cpp:163
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:259