P4C
The P4 Compiler
Loading...
Searching...
No Matches
validateProperties.h
1/*
2 * Copyright 2016 VMware, Inc.
3 * SPDX-FileCopyrightText: 2016 VMware, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef MIDEND_VALIDATEPROPERTIES_H_
9#define MIDEND_VALIDATEPROPERTIES_H_
10
11#include "frontends/p4/typeMap.h"
12#include "ir/ir.h"
13#include "ir/visitor.h"
14
15namespace P4 {
16
23class ValidateTableProperties : public Inspector {
24 std::set<cstring> legalProperties;
25
26 public:
27 ValidateTableProperties(const std::initializer_list<cstring> legal) {
28 setName("ValidateTableProperties");
29 legalProperties.emplace("actions");
30 legalProperties.emplace("default_action");
31 legalProperties.emplace("key");
32 legalProperties.emplace("entries");
33 for (auto l : legal) {
34 legalProperties.emplace(l);
35 }
36 }
37 void postorder(const IR::Property *property) override;
38 // don't check properties in externs (Declaration_Instances)
39 bool preorder(const IR::Declaration_Instance * /*instance*/) override { return false; }
40};
41
42} // namespace P4
43
44#endif /* MIDEND_VALIDATEPROPERTIES_H_ */
Definition visitor.h:418
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13