P4C
The P4 Compiler
Loading...
Searching...
No Matches
validateValueSets.h
1/*
2 * Copyright 2022 VMware, Inc.
3 * SPDX-FileCopyrightText: 2022 VMware, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef FRONTENDS_P4_VALIDATEVALUESETS_H_
9#define FRONTENDS_P4_VALIDATEVALUESETS_H_
10
11#include "frontends/p4/typeMap.h"
12#include "ir/ir.h"
13#include "lib/error.h"
14
15namespace P4 {
16
20class ValidateValueSets final : public Inspector {
21 public:
22 ValidateValueSets() { setName("ValidateValueSets"); }
23 void postorder(const IR::P4ValueSet *valueSet) override {
24 if (!valueSet->size->is<IR::Constant>()) {
25 ::P4::error(ErrorType::ERR_EXPECTED, "%1%: value_set size must be constant",
26 valueSet->size);
27 }
28 }
29};
30
31} // namespace P4
32
33#endif /* FRONTENDS_P4_VALIDATEVALUESETS_H_ */
Definition visitor.h:418
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13
void error(const char *format, Args &&...args)
Report an error with the given message.
Definition lib/error.h:58