blob: 5f93a0343861bbc0cc90f5e812c88827ffaf2fa1 [file] [log] [blame]
alokp@chromium.org8b851c62012-06-15 16:25:11 +00001//
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
12TDiagnostics::TDiagnostics(TInfoSink& infoSink) : mInfoSink(infoSink)
13{
14}
15
16TDiagnostics::~TDiagnostics()
17{
18}
19
20void 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
35void TDiagnostics::writeDebug(const std::string& str)
36{
37 mInfoSink.debug << str;
38}
39
40void TDiagnostics::print(ID id,
41 const pp::SourceLocation& loc,
42 const std::string& text)
43{
44}