24#ifndef IR_IR_TRAVERSAL_H_
25#define IR_IR_TRAVERSAL_H_
26#define IR_IR_TRAVERSAL_INTERNAL_ENABLE
30namespace P4::IR::Traversal {
37 explicit Assign(
const T &value) : value(value) {}
51 explicit Index(
size_t value) : value(value) {}
58#include "ir-traversal-internal.h"
60namespace P4::IR::Traversal {
120template <
typename Obj,
typename... Selectors>
121Obj *modify(Obj *obj, Selectors &&...selectors) {
122 return Detail::Traverse::modify(obj, std::forward<Selectors>(selectors)...);
127template <
typename Obj,
typename... Selectors>
128Obj *apply(
const Obj *obj, Selectors &&...selectors) {
129 return Detail::Traverse::modify(obj->clone(), std::forward<Selectors>(selectors)...);
134#undef IR_IR_TRAVERSAL_INTERNAL_ENABLE
A selector used at the end of selector chain to assign to the current sub-object. e....
Definition ir-traversal.h:36
Select an index of a integer-indexed sub-object. This is useful e.g. to select first parameter of a m...
Definition ir-traversal.h:50