1 // 2 // Copyright (c) 2002-2010 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/translator/InfoSink.h" 8 9 #include "compiler/translator/ImmutableString.h" 10 11 namespace sh 12 { 13 prefix(Severity severity)14void TInfoSinkBase::prefix(Severity severity) 15 { 16 switch (severity) 17 { 18 case SH_WARNING: 19 sink.append("WARNING: "); 20 break; 21 case SH_ERROR: 22 sink.append("ERROR: "); 23 break; 24 default: 25 sink.append("UNKOWN ERROR: "); 26 break; 27 } 28 } 29 operator <<(const ImmutableString & str)30TInfoSinkBase &TInfoSinkBase::operator<<(const ImmutableString &str) 31 { 32 sink.append(str.data()); 33 return *this; 34 } 35 location(int file,int line)36void TInfoSinkBase::location(int file, int line) 37 { 38 TPersistStringStream stream; 39 if (line) 40 stream << file << ":" << line; 41 else 42 stream << file << ":? "; 43 stream << ": "; 44 45 sink.append(stream.str()); 46 } 47 48 } // namespace sh 49