P4C
The P4 Compiler
Loading...
Searching...
No Matches
checkNamedArgs.h
1/*
2 * Copyright 2018 VMware, Inc.
3 * SPDX-FileCopyrightText: 2018 VMware, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef FRONTENDS_P4_CHECKNAMEDARGS_H_
9#define FRONTENDS_P4_CHECKNAMEDARGS_H_
10
11#include "ir/ir.h"
12#include "ir/visitor.h"
13
14namespace P4 {
15
20class CheckNamedArgs : public Inspector {
21 bool checkOptionalParameters(const IR::ParameterList *params);
22
23 public:
24 CheckNamedArgs() { setName("CheckNamedArgs"); }
25
26 bool checkArguments(const IR::Vector<IR::Argument> *arguments);
27 bool preorder(const IR::MethodCallExpression *call) override {
28 return checkArguments(call->arguments);
29 }
30 bool preorder(const IR::Declaration_Instance *call) override {
31 return checkArguments(call->arguments);
32 }
33 bool preorder(const IR::Parameter *parameter) override;
34 bool preorder(const IR::P4Control *control) override {
35 return checkOptionalParameters(control->getConstructorParameters());
36 }
37 bool preorder(const IR::P4Parser *parser) override {
38 return checkOptionalParameters(parser->getConstructorParameters());
39 }
40 bool preorder(const IR::Function *function) override {
41 return checkOptionalParameters(function->getParameters());
42 }
43};
44
45} // namespace P4
46
47#endif /* FRONTENDS_P4_CHECKNAMEDARGS_H_ */
Definition ir/vector.h:59
Definition visitor.h:418
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13