michael@0: // michael@0: // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #include "compiler/InfoSink.h" michael@0: michael@0: void TInfoSinkBase::prefix(TPrefixType p) { michael@0: switch(p) { michael@0: case EPrefixNone: michael@0: break; michael@0: case EPrefixWarning: michael@0: sink.append("WARNING: "); michael@0: break; michael@0: case EPrefixError: michael@0: sink.append("ERROR: "); michael@0: break; michael@0: case EPrefixInternalError: michael@0: sink.append("INTERNAL ERROR: "); michael@0: break; michael@0: case EPrefixUnimplemented: michael@0: sink.append("UNIMPLEMENTED: "); michael@0: break; michael@0: case EPrefixNote: michael@0: sink.append("NOTE: "); michael@0: break; michael@0: default: michael@0: sink.append("UNKOWN ERROR: "); michael@0: break; michael@0: } michael@0: } michael@0: michael@0: void TInfoSinkBase::location(int file, int line) { michael@0: TPersistStringStream stream; michael@0: if (line) michael@0: stream << file << ":" << line; michael@0: else michael@0: stream << file << ":? "; michael@0: stream << ": "; michael@0: michael@0: sink.append(stream.str()); michael@0: } michael@0: michael@0: void TInfoSinkBase::location(const TSourceLoc& loc) { michael@0: location(loc.first_file, loc.first_line); michael@0: } michael@0: michael@0: void TInfoSinkBase::message(TPrefixType p, const TSourceLoc& loc, const char* m) { michael@0: prefix(p); michael@0: location(loc); michael@0: sink.append(m); michael@0: sink.append("\n"); michael@0: }