Line data Source code
1 : //
2 : // Copyright (c) 2012-2013 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 : #ifndef COMPILER_TRANSLATOR_DIAGNOSTICS_H_
8 : #define COMPILER_TRANSLATOR_DIAGNOSTICS_H_
9 :
10 : #include "common/angleutils.h"
11 : #include "compiler/preprocessor/DiagnosticsBase.h"
12 :
13 : namespace sh
14 : {
15 :
16 : class TInfoSink;
17 : struct TSourceLoc;
18 :
19 : class TDiagnostics : public pp::Diagnostics, angle::NonCopyable
20 : {
21 : public:
22 : TDiagnostics(TInfoSink& infoSink);
23 : ~TDiagnostics() override;
24 :
25 : TInfoSink& infoSink() { return mInfoSink; }
26 :
27 0 : int numErrors() const { return mNumErrors; }
28 : int numWarnings() const { return mNumWarnings; }
29 :
30 : void writeInfo(Severity severity,
31 : const pp::SourceLocation& loc,
32 : const std::string& reason,
33 : const std::string& token,
34 : const std::string& extra);
35 :
36 : void error(const TSourceLoc &loc, const char *reason, const char *token, const char *extraInfo);
37 : void warning(const TSourceLoc &loc,
38 : const char *reason,
39 : const char *token,
40 : const char *extraInfo);
41 :
42 : protected:
43 : void print(ID id, const pp::SourceLocation &loc, const std::string &text) override;
44 :
45 : private:
46 : TInfoSink& mInfoSink;
47 : int mNumErrors;
48 : int mNumWarnings;
49 : };
50 :
51 : } // namespace sh
52 :
53 : #endif // COMPILER_TRANSLATOR_DIAGNOSTICS_H_
|