2007-06-27 11:19:45 +08:00
|
|
|
//===--- TextDiagnosticBuffer.cpp - Buffer Text Diagnostics ---------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by Bill Wendling and is distributed under the
|
|
|
|
// University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This is a concrete diagnostic client, which buffers the diagnostic messages.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "TextDiagnosticBuffer.h"
|
|
|
|
#include "clang/Basic/SourceManager.h"
|
|
|
|
using namespace clang;
|
|
|
|
|
|
|
|
/// HandleDiagnostic - Store the errors & warnings that are reported.
|
|
|
|
///
|
2007-12-01 06:53:43 +08:00
|
|
|
void TextDiagnosticBuffer::HandleDiagnostic(Diagnostic &Diags,
|
|
|
|
Diagnostic::Level Level,
|
2007-12-13 06:39:36 +08:00
|
|
|
FullSourceLoc Pos,
|
2007-06-27 11:19:45 +08:00
|
|
|
diag::kind ID,
|
|
|
|
const std::string *Strs,
|
|
|
|
unsigned NumStrs,
|
|
|
|
const SourceRange *,
|
|
|
|
unsigned) {
|
|
|
|
switch (Level) {
|
|
|
|
default: assert(0 && "Diagnostic not handled during diagnostic buffering!");
|
|
|
|
case Diagnostic::Warning:
|
2007-12-13 06:39:36 +08:00
|
|
|
Warnings.push_back(std::make_pair(Pos.getLocation(),
|
|
|
|
FormatDiagnostic(Diags, Level, ID,
|
|
|
|
Strs, NumStrs)));
|
2007-06-27 11:19:45 +08:00
|
|
|
break;
|
|
|
|
case Diagnostic::Error:
|
2007-12-13 06:39:36 +08:00
|
|
|
Errors.push_back(std::make_pair(Pos.getLocation(),
|
|
|
|
FormatDiagnostic(Diags, Level, ID,
|
|
|
|
Strs, NumStrs)));
|
2007-06-27 11:19:45 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|