 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
70.0% |
7 / 10 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
100.0% |
10 / 10 |
| |
|
Line Coverage: |
85.0% |
17 / 20 |
| |
 |
|
 |
1 : //===--- TextDiagnosticBuffer.cpp - Buffer Text Diagnostics ---------------===//
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 is a concrete diagnostic client, which buffers the diagnostic messages.
11 : //
12 : //===----------------------------------------------------------------------===//
13 :
14 : #include "clang/Frontend/TextDiagnosticBuffer.h"
15 : #include "llvm/ADT/SmallString.h"
16 : using namespace clang;
17 :
18 : /// HandleDiagnostic - Store the errors, warnings, and notes that are
19 : /// reported.
20 : ///
21 : void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic::Level Level,
22 7099: const DiagnosticInfo &Info) {
23 7099: llvm::SmallString<100> Buf;
24 7099: Info.FormatDiagnostic(Buf);
0: branch 0 not taken
1818: branch 1 taken
2194: branch 2 taken
3087: branch 3 taken
25 7099: switch (Level) {
26 0: default: assert(0 && "Diagnostic not handled during diagnostic buffering!");
27 : case Diagnostic::Note:
28 1818: Notes.push_back(std::make_pair(Info.getLocation(), Buf.str()));
29 1818: break;
30 : case Diagnostic::Warning:
31 2194: Warnings.push_back(std::make_pair(Info.getLocation(), Buf.str()));
32 2194: break;
33 : case Diagnostic::Error:
34 : case Diagnostic::Fatal:
35 3087: Errors.push_back(std::make_pair(Info.getLocation(), Buf.str()));
36 : break;
37 7099: }
38 7099: }
39 :
40 2514: void TextDiagnosticBuffer::FlushDiagnostics(Diagnostic &Diags) const {
41 : // FIXME: Flush the diagnostics in order.
1: branch 4 taken
2514: branch 5 taken
42 2515: for (const_iterator it = err_begin(), ie = err_end(); it != ie; ++it)
43 1: Diags.Report(Diags.getCustomDiagID(Diagnostic::Error, it->second.c_str()));
0: branch 4 not taken
2514: branch 5 taken
44 2514: for (const_iterator it = warn_begin(), ie = warn_end(); it != ie; ++it)
45 0: Diags.Report(Diags.getCustomDiagID(Diagnostic::Warning,it->second.c_str()));
0: branch 4 not taken
2514: branch 5 taken
46 2514: for (const_iterator it = note_begin(), ie = note_end(); it != ie; ++it)
47 0: Diags.Report(Diags.getCustomDiagID(Diagnostic::Note, it->second.c_str()));
48 2514: }
Generated: 2010-02-10 01:31 by zcov