alokp@chromium.org | 8b851c6 | 2012-06-15 16:25:11 +0000 | [diff] [blame^] | 1 | // |
| 2 | // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. |
| 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | #include "compiler/Diagnostics.h" |
| 8 | |
| 9 | #include "compiler/InfoSink.h" |
| 10 | #include "compiler/preprocessor/new/SourceLocation.h" |
| 11 | |
| 12 | TDiagnostics::TDiagnostics(TInfoSink& infoSink) : mInfoSink(infoSink) |
| 13 | { |
| 14 | } |
| 15 | |
| 16 | TDiagnostics::~TDiagnostics() |
| 17 | { |
| 18 | } |
| 19 | |
| 20 | void TDiagnostics::writeInfo(Severity severity, |
| 21 | const pp::SourceLocation& loc, |
| 22 | const std::string& reason, |
| 23 | const std::string& token, |
| 24 | const std::string& extra) |
| 25 | { |
| 26 | TInfoSinkBase& sink = mInfoSink.info; |
| 27 | TPrefixType prefix = severity == ERROR ? EPrefixError : EPrefixWarning; |
| 28 | |
| 29 | /* VC++ format: file(linenum) : error #: 'token' : extrainfo */ |
| 30 | sink.prefix(prefix); |
| 31 | sink.location(EncodeSourceLoc(loc.file, loc.line)); |
| 32 | sink << "'" << token << "' : " << reason << " " << extra << "\n"; |
| 33 | } |
| 34 | |
| 35 | void TDiagnostics::writeDebug(const std::string& str) |
| 36 | { |
| 37 | mInfoSink.debug << str; |
| 38 | } |
| 39 | |
| 40 | void TDiagnostics::print(ID id, |
| 41 | const pp::SourceLocation& loc, |
| 42 | const std::string& text) |
| 43 | { |
| 44 | } |