blob: 5ddbc6df2ff57b7aec84d4f829f74eb216872286 [file] [log] [blame]
{{- /*
--------------------------------------------------------------------------------
Template file for use with tools/src/cmd/gen to generate diagnostic_control.h
See:
* tools/src/cmd/gen for structures used by this template
* https://golang.org/pkg/text/template/ for documentation on the template syntax
--------------------------------------------------------------------------------
*/ -}}
{{- Import "src/tint/templates/enums.tmpl.inc" -}}
#ifndef SRC_TINT_AST_DIAGNOSTIC_CONTROL_H_
#define SRC_TINT_AST_DIAGNOSTIC_CONTROL_H_
#include <ostream>
#include <string>
#include "src/tint/ast/node.h"
// Forward declarations
namespace tint::ast {
class IdentifierExpression;
} // namespace tint::ast
namespace tint::ast {
/// The diagnostic severity control.
{{ Eval "DeclareEnum" (Sem.Enum "diagnostic_severity") }}
/// A diagnostic control used for diagnostic directives and attributes.
class DiagnosticControl : public Castable<DiagnosticControl, Node> {
public:
/// Constructor
/// @param pid the identifier of the program that owns this node
/// @param nid the unique node identifier
/// @param src the source of this node
/// @param sev the diagnostic severity
/// @param rule the diagnostic rule name
DiagnosticControl(ProgramID pid,
NodeID nid,
const Source& src,
DiagnosticSeverity sev,
const IdentifierExpression* rule)
: Base(pid, nid, src), severity(sev), rule_name(rule) {}
~DiagnosticControl() override;
/// Clones this node and all transitive child nodes using the `CloneContext` `ctx`.
/// @param ctx the clone context
/// @return the newly cloned node
const DiagnosticControl* Clone(CloneContext* ctx) const override;
/// The diagnostic severity control.
DiagnosticSeverity severity;
/// The diagnostic rule name.
const IdentifierExpression* rule_name;
};
} // namespace tint::ast
#endif // SRC_TINT_AST_DIAGNOSTIC_CONTROL_H_