Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | // |
michael@0 | 2 | // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. |
michael@0 | 3 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 4 | // found in the LICENSE file. |
michael@0 | 5 | // |
michael@0 | 6 | |
michael@0 | 7 | #include "compiler/InfoSink.h" |
michael@0 | 8 | |
michael@0 | 9 | void TInfoSinkBase::prefix(TPrefixType p) { |
michael@0 | 10 | switch(p) { |
michael@0 | 11 | case EPrefixNone: |
michael@0 | 12 | break; |
michael@0 | 13 | case EPrefixWarning: |
michael@0 | 14 | sink.append("WARNING: "); |
michael@0 | 15 | break; |
michael@0 | 16 | case EPrefixError: |
michael@0 | 17 | sink.append("ERROR: "); |
michael@0 | 18 | break; |
michael@0 | 19 | case EPrefixInternalError: |
michael@0 | 20 | sink.append("INTERNAL ERROR: "); |
michael@0 | 21 | break; |
michael@0 | 22 | case EPrefixUnimplemented: |
michael@0 | 23 | sink.append("UNIMPLEMENTED: "); |
michael@0 | 24 | break; |
michael@0 | 25 | case EPrefixNote: |
michael@0 | 26 | sink.append("NOTE: "); |
michael@0 | 27 | break; |
michael@0 | 28 | default: |
michael@0 | 29 | sink.append("UNKOWN ERROR: "); |
michael@0 | 30 | break; |
michael@0 | 31 | } |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | void TInfoSinkBase::location(int file, int line) { |
michael@0 | 35 | TPersistStringStream stream; |
michael@0 | 36 | if (line) |
michael@0 | 37 | stream << file << ":" << line; |
michael@0 | 38 | else |
michael@0 | 39 | stream << file << ":? "; |
michael@0 | 40 | stream << ": "; |
michael@0 | 41 | |
michael@0 | 42 | sink.append(stream.str()); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | void TInfoSinkBase::location(const TSourceLoc& loc) { |
michael@0 | 46 | location(loc.first_file, loc.first_line); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | void TInfoSinkBase::message(TPrefixType p, const TSourceLoc& loc, const char* m) { |
michael@0 | 50 | prefix(p); |
michael@0 | 51 | location(loc); |
michael@0 | 52 | sink.append(m); |
michael@0 | 53 | sink.append("\n"); |
michael@0 | 54 | } |