blob: 1f6075ea921e47d23c30f9cf136f4a606600e48d [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===--- TextDiagnosticBuffer.cpp - Buffer Text Diagnostics ---------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Bill Wendling and is distributed under the
6// University of Illinois Open Source 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 "TextDiagnosticBuffer.h"
15#include "clang/Basic/SourceManager.h"
16using namespace clang;
17
18/// HandleDiagnostic - Store the errors & warnings that are reported.
19///
20void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic::Level Level,
21 SourceLocation Pos,
22 diag::kind ID,
23 const std::string *Strs,
24 unsigned NumStrs,
25 const SourceRange *,
26 unsigned) {
27 switch (Level) {
28 default: assert(0 && "Diagnostic not handled during diagnostic buffering!");
29 case Diagnostic::Warning:
30 Warnings.push_back(std::make_pair(Pos, FormatDiagnostic(Level, ID, Strs,
31 NumStrs)));
32 break;
33 case Diagnostic::Error:
34 Errors.push_back(std::make_pair(Pos, FormatDiagnostic(Level, ID, Strs,
35 NumStrs)));
36 break;
37 }
38}