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