/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/IR/DiagnosticPrinter.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | |
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" |
19 | | |
20 | | using namespace llvm; |
21 | | |
22 | 0 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(char C) { |
23 | 0 | Stream << C; |
24 | 0 | return *this; |
25 | 0 | } |
26 | | |
27 | 0 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned char C) { |
28 | 0 | Stream << C; |
29 | 0 | return *this; |
30 | 0 | } |
31 | | |
32 | 0 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(signed char C) { |
33 | 0 | Stream << C; |
34 | 0 | return *this; |
35 | 0 | } |
36 | | |
37 | 20 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(StringRef Str) { |
38 | 20 | Stream << Str; |
39 | 20 | return *this; |
40 | 20 | } |
41 | | |
42 | 17.8k | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const char *Str) { |
43 | 17.8k | Stream << Str; |
44 | 17.8k | return *this; |
45 | 17.8k | } |
46 | | |
47 | | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<( |
48 | 2.68k | const std::string &Str) { |
49 | 2.68k | Stream << Str; |
50 | 2.68k | return *this; |
51 | 2.68k | } |
52 | | |
53 | 0 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned long N) { |
54 | 0 | Stream << N; |
55 | 0 | return *this; |
56 | 0 | } |
57 | 0 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long N) { |
58 | 0 | Stream << N; |
59 | 0 | return *this; |
60 | 0 | } |
61 | | |
62 | | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<( |
63 | 62 | unsigned long long N) { |
64 | 62 | Stream << N; |
65 | 62 | return *this; |
66 | 62 | } |
67 | | |
68 | 0 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long long N) { |
69 | 0 | Stream << N; |
70 | 0 | return *this; |
71 | 0 | } |
72 | | |
73 | 0 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const void *P) { |
74 | 0 | Stream << P; |
75 | 0 | return *this; |
76 | 0 | } |
77 | | |
78 | 81 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned int N) { |
79 | 81 | Stream << N; |
80 | 81 | return *this; |
81 | 81 | } |
82 | | |
83 | 0 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(int N) { |
84 | 0 | Stream << N; |
85 | 0 | return *this; |
86 | 0 | } |
87 | | |
88 | 0 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(double N) { |
89 | 0 | Stream << N; |
90 | 0 | return *this; |
91 | 0 | } |
92 | | |
93 | 390 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Twine &Str) { |
94 | 390 | Str.print(Stream); |
95 | 390 | return *this; |
96 | 390 | } |
97 | | |
98 | | // IR related types. |
99 | 16.2k | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Value &V) { |
100 | 16.2k | Stream << V.getName(); |
101 | 16.2k | return *this; |
102 | 16.2k | } |
103 | | |
104 | 53 | DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Module &M) { |
105 | 53 | Stream << M.getModuleIdentifier(); |
106 | 53 | return *this; |
107 | 53 | } |
108 | | |
109 | | // Other types. |
110 | | DiagnosticPrinter &DiagnosticPrinterRawOStream:: |
111 | 142 | operator<<(const SMDiagnostic &Diag) { |
112 | 142 | // We don't have to print the SMDiagnostic kind, as the diagnostic severity |
113 | 142 | // is printed by the diagnostic handler. |
114 | 142 | Diag.print("", Stream, /*ShowColors=*/true, /*ShowKindLabel=*/false); |
115 | 142 | return *this; |
116 | 142 | } |