Line data Source code
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 : namespace sh
10 : {
11 :
12 0 : void TInfoSinkBase::prefix(TPrefixType p) {
13 0 : switch(p) {
14 : case EPrefixNone:
15 0 : break;
16 : case EPrefixWarning:
17 0 : sink.append("WARNING: ");
18 0 : break;
19 : case EPrefixError:
20 0 : sink.append("ERROR: ");
21 0 : break;
22 : case EPrefixInternalError:
23 0 : sink.append("INTERNAL ERROR: ");
24 0 : break;
25 : case EPrefixUnimplemented:
26 0 : sink.append("UNIMPLEMENTED: ");
27 0 : break;
28 : case EPrefixNote:
29 0 : sink.append("NOTE: ");
30 0 : break;
31 : default:
32 0 : sink.append("UNKOWN ERROR: ");
33 0 : break;
34 : }
35 0 : }
36 :
37 0 : void TInfoSinkBase::location(int file, int line) {
38 0 : TPersistStringStream stream;
39 0 : if (line)
40 0 : stream << file << ":" << line;
41 : else
42 0 : stream << file << ":? ";
43 0 : stream << ": ";
44 :
45 0 : sink.append(stream.str());
46 0 : }
47 :
48 0 : void TInfoSinkBase::location(const TSourceLoc& loc) {
49 0 : location(loc.first_file, loc.first_line);
50 0 : }
51 :
52 0 : void TInfoSinkBase::message(TPrefixType p, const TSourceLoc& loc, const char* m) {
53 0 : prefix(p);
54 0 : location(loc);
55 0 : sink.append(m);
56 0 : sink.append("\n");
57 0 : }
58 :
59 : } // namespace sh
|