LLVM  8.0.1
DiagnosticPrinter.cpp
Go to the documentation of this file.
1 //===- llvm/Support/DiagnosticInfo.cpp - Diagnostic Definitions -*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines a diagnostic printer relying on raw_ostream.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "llvm/ADT/Twine.h"
16 #include "llvm/IR/Module.h"
17 #include "llvm/IR/Value.h"
18 #include "llvm/Support/SourceMgr.h"
20 
21 using namespace llvm;
22 
24  Stream << C;
25  return *this;
26 }
27 
29  Stream << C;
30  return *this;
31 }
32 
34  Stream << C;
35  return *this;
36 }
37 
39  Stream << Str;
40  return *this;
41 }
42 
44  Stream << Str;
45  return *this;
46 }
47 
49  const std::string &Str) {
50  Stream << Str;
51  return *this;
52 }
53 
55  Stream << N;
56  return *this;
57 }
59  Stream << N;
60  return *this;
61 }
62 
64  unsigned long long N) {
65  Stream << N;
66  return *this;
67 }
68 
70  Stream << N;
71  return *this;
72 }
73 
75  Stream << P;
76  return *this;
77 }
78 
80  Stream << N;
81  return *this;
82 }
83 
85  Stream << N;
86  return *this;
87 }
88 
90  Stream << N;
91  return *this;
92 }
93 
95  Str.print(Stream);
96  return *this;
97 }
98 
99 // IR related types.
101  Stream << V.getName();
102  return *this;
103 }
104 
107  return *this;
108 }
109 
110 // Other types.
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);
116  return *this;
117 }
uint64_t CallInst * C
This class represents lattice values for constants.
Definition: AllocatorList.h:24
void print(const char *ProgName, raw_ostream &S, bool ShowColors=true, bool ShowKindLabel=true) const
Definition: SourceMgr.cpp:374
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:81
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:73
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
void print(raw_ostream &OS) const
Write the concatenated string represented by this twine to the stream OS.
Definition: Twine.cpp:164
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:260