1 | // Copyright 2016 The SwiftShader Authors. All Rights Reserved. |
2 | // |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | // you may not use this file except in compliance with the License. |
5 | // You may obtain a copy of the License at |
6 | // |
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | // |
9 | // Unless required by applicable law or agreed to in writing, software |
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | // See the License for the specific language governing permissions and |
13 | // limitations under the License. |
14 | |
15 | #ifndef COMPILER_DIAGNOSTICS_H_ |
16 | #define COMPILER_DIAGNOSTICS_H_ |
17 | |
18 | #include "preprocessor/DiagnosticsBase.h" |
19 | |
20 | class TInfoSink; |
21 | |
22 | class TDiagnostics : public pp::Diagnostics |
23 | { |
24 | public: |
25 | TDiagnostics(TInfoSink& infoSink); |
26 | virtual ~TDiagnostics(); |
27 | |
28 | int shaderVersion() const { return mShaderVersion; } |
29 | TInfoSink& infoSink() { return mInfoSink; } |
30 | |
31 | int numErrors() const { return mNumErrors; } |
32 | int numWarnings() const { return mNumWarnings; } |
33 | int numInfos() const { return mNumInfos; } |
34 | |
35 | void setShaderVersion(int version); |
36 | |
37 | void writeInfo(Severity severity, |
38 | const pp::SourceLocation& loc, |
39 | const std::string& reason, |
40 | const std::string& token, |
41 | const std::string& ); |
42 | |
43 | void writeDebug(const std::string& str); |
44 | |
45 | protected: |
46 | virtual void print(ID id, |
47 | const pp::SourceLocation& loc, |
48 | const std::string& text); |
49 | |
50 | private: |
51 | int mShaderVersion; |
52 | |
53 | TInfoSink& mInfoSink; |
54 | int mNumErrors; |
55 | int mNumWarnings; |
56 | int mNumInfos; |
57 | }; |
58 | |
59 | #endif // COMPILER_DIAGNOSTICS_H_ |
60 | |