P4C
The P4 Compiler
Loading...
Searching...
No Matches
copySrcInfo.h
1/*
2 * SPDX-FileCopyrightText: 2022 VMware, Inc.
3 * Copyright 2022-present VMware, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef FRONTENDS_COMMON_COPYSRCINFO_H_
9#define FRONTENDS_COMMON_COPYSRCINFO_H_
10
11#include "ir/ir.h"
12
13namespace P4 {
14
17class CopySrcInfo : public Transform {
18 const Util::SourceInfo &srcInfo;
19
20 public:
21 explicit CopySrcInfo(const Util::SourceInfo &srcInfo) : srcInfo(srcInfo) {}
23 const IR::Node *preorder(IR::Node *node) {
24 auto result = node->clone();
25 result->srcInfo = srcInfo;
26 prune();
27 return result;
28 }
29};
30
31} // namespace P4
32
33#endif // FRONTENDS_COMMON_COPYSRCINFO_H_
const IR::Node * preorder(IR::Node *node)
Only visit first node.
Definition copySrcInfo.h:23
Definition node.h:53
Definition visitor.h:442
Definition source_file.h:132
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13