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
13
namespace
P4
{
14
17
class
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_
P4::CopySrcInfo::preorder
const IR::Node * preorder(IR::Node *node)
Only visit first node.
Definition
copySrcInfo.h:23
P4::IR::Node
Definition
node.h:53
P4::Transform
Definition
visitor.h:442
P4::Util::SourceInfo
Definition
source_file.h:132
P4
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition
applyOptionsPragmas.cpp:13
frontends
common
copySrcInfo.h
Generated by
1.13.2