Path: blob/main_old/src/compiler/translator/Diagnostics.h
1693 views
//1// Copyright 2012 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56#ifndef COMPILER_TRANSLATOR_DIAGNOSTICS_H_7#define COMPILER_TRANSLATOR_DIAGNOSTICS_H_89#include "common/angleutils.h"10#include "compiler/preprocessor/DiagnosticsBase.h"11#include "compiler/translator/Severity.h"1213namespace sh14{1516class TInfoSinkBase;17struct TSourceLoc;1819class TDiagnostics : public angle::pp::Diagnostics, angle::NonCopyable20{21public:22TDiagnostics(TInfoSinkBase &infoSink);23~TDiagnostics() override;2425int numErrors() const { return mNumErrors; }26int numWarnings() const { return mNumWarnings; }2728void error(const angle::pp::SourceLocation &loc, const char *reason, const char *token);29void warning(const angle::pp::SourceLocation &loc, const char *reason, const char *token);3031void error(const TSourceLoc &loc, const char *reason, const char *token);32void warning(const TSourceLoc &loc, const char *reason, const char *token);3334void globalError(const char *message);3536void resetErrorCount();3738protected:39void writeInfo(Severity severity,40const angle::pp::SourceLocation &loc,41const char *reason,42const char *token);4344void print(ID id, const angle::pp::SourceLocation &loc, const std::string &text) override;4546private:47TInfoSinkBase &mInfoSink;48int mNumErrors;49int mNumWarnings;50};5152// Diagnostics wrapper to use when the code is only allowed to generate warnings.53class PerformanceDiagnostics : public angle::NonCopyable54{55public:56PerformanceDiagnostics(TDiagnostics *diagnostics);5758void warning(const TSourceLoc &loc, const char *reason, const char *token);5960private:61TDiagnostics *mDiagnostics;62};6364} // namespace sh6566#endif // COMPILER_TRANSLATOR_DIAGNOSTICS_H_676869