zenilib: zenilib/jni/external/angle/src/compiler/Diagnostics.cpp Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Diagnostics.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2012 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/Diagnostics.h"
8
9 #include "compiler/debug.h"
10 #include "compiler/InfoSink.h"
11 #include "compiler/preprocessor/SourceLocation.h"
12
13 TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
14 mInfoSink(infoSink),
15 mNumErrors(0),
16 mNumWarnings(0)
17 {
18 }
19
20 TDiagnostics::~TDiagnostics()
21 {
22 }
23
24 void TDiagnostics::writeInfo(Severity severity,
25 const pp::SourceLocation& loc,
26 const std::string& reason,
27 const std::string& token,
28 const std::string& extra)
29 {
30 TPrefixType prefix = EPrefixNone;
31 switch (severity)
32 {
33 case ERROR:
34 ++mNumErrors;
35 prefix = EPrefixError;
36 break;
37 case WARNING:
38 ++mNumWarnings;
39 prefix = EPrefixWarning;
40 break;
41 default:
42 UNREACHABLE();
43 break;
44 }
45
46 TInfoSinkBase& sink = mInfoSink.info;
47 /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
48 sink.prefix(prefix);
49 sink.location(loc.file, loc.line);
50 sink << "'" << token << "' : " << reason << " " << extra << "\n";
51 }
52
53 void TDiagnostics::writeDebug(const std::string& str)
54 {
55 mInfoSink.debug << str;
56 }
57
58 void TDiagnostics::print(ID id,
59 const pp::SourceLocation& loc,
60 const std::string& text)
61 {
62 writeInfo(severity(id), loc, message(id), text, "");
63 }
sink
GLsizei GLenum GLboolean sink
Definition: glew.h:4448
TPrefixType
TPrefixType
Definition: InfoSink.h:23
EPrefixError
Definition: InfoSink.h:26
debug.h
TDiagnostics::~TDiagnostics
virtual ~TDiagnostics()
Definition: Diagnostics.cpp:20
EPrefixNone
Definition: InfoSink.h:24
pp::Diagnostics::WARNING
Definition: DiagnosticsBase.h:25
TInfoSinkBase
Definition: InfoSink.h:38
TInfoSink::debug
TInfoSinkBase debug
Definition: InfoSink.h:111
pp::SourceLocation::file
int file
Definition: SourceLocation.h:23
severity
GLenum severity
Definition: glew.h:2538
pp::Diagnostics::ERROR
Definition: DiagnosticsBase.h:24
TDiagnostics::writeInfo
void writeInfo(Severity severity, const pp::SourceLocation &loc, const std::string &reason, const std::string &token, const std::string &extra)
Definition: Diagnostics.cpp:24
EPrefixWarning
Definition: InfoSink.h:25
SourceLocation.h
TDiagnostics::print
virtual void print(ID id, const pp::SourceLocation &loc, const std::string &text)
Definition: Diagnostics.cpp:58
Diagnostics.h
UNREACHABLE
#define UNREACHABLE()
Definition: debug.h:47
TDiagnostics::writeDebug
void writeDebug(const std::string &str)
Definition: Diagnostics.cpp:53
string
GLsizei const GLcharARB ** string
Definition: glew.h:5638
pp::Diagnostics::message
std::string message(ID id)
Definition: DiagnosticsBase.cpp:38
InfoSink.h
pp::Diagnostics::severity
Severity severity(ID id)
Definition: DiagnosticsBase.cpp:26
str
#define str(s)
pp::Diagnostics::ID
ID
Definition: DiagnosticsBase.h:27
TInfoSink::info
TInfoSinkBase info
Definition: InfoSink.h:110
pp::SourceLocation::line
int line
Definition: SourceLocation.h:24
pp::SourceLocation
Definition: SourceLocation.h:13
TDiagnostics::TDiagnostics
TDiagnostics(TInfoSink &infoSink)
Definition: Diagnostics.cpp:13
TInfoSinkBase::location
void location(int file, int line)
Definition: InfoSink.cpp:34
TInfoSinkBase::prefix
void prefix(TPrefixType p)
Definition: InfoSink.cpp:9
pp::Diagnostics::Severity
Severity
Definition: DiagnosticsBase.h:22
TInfoSink
Definition: InfoSink.h:108