1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/InfoSink.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +// 1.5 +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 + 1.10 +#include "compiler/InfoSink.h" 1.11 + 1.12 +void TInfoSinkBase::prefix(TPrefixType p) { 1.13 + switch(p) { 1.14 + case EPrefixNone: 1.15 + break; 1.16 + case EPrefixWarning: 1.17 + sink.append("WARNING: "); 1.18 + break; 1.19 + case EPrefixError: 1.20 + sink.append("ERROR: "); 1.21 + break; 1.22 + case EPrefixInternalError: 1.23 + sink.append("INTERNAL ERROR: "); 1.24 + break; 1.25 + case EPrefixUnimplemented: 1.26 + sink.append("UNIMPLEMENTED: "); 1.27 + break; 1.28 + case EPrefixNote: 1.29 + sink.append("NOTE: "); 1.30 + break; 1.31 + default: 1.32 + sink.append("UNKOWN ERROR: "); 1.33 + break; 1.34 + } 1.35 +} 1.36 + 1.37 +void TInfoSinkBase::location(int file, int line) { 1.38 + TPersistStringStream stream; 1.39 + if (line) 1.40 + stream << file << ":" << line; 1.41 + else 1.42 + stream << file << ":? "; 1.43 + stream << ": "; 1.44 + 1.45 + sink.append(stream.str()); 1.46 +} 1.47 + 1.48 +void TInfoSinkBase::location(const TSourceLoc& loc) { 1.49 + location(loc.first_file, loc.first_line); 1.50 +} 1.51 + 1.52 +void TInfoSinkBase::message(TPrefixType p, const TSourceLoc& loc, const char* m) { 1.53 + prefix(p); 1.54 + location(loc); 1.55 + sink.append(m); 1.56 + sink.append("\n"); 1.57 +}