Skip to content

Commit

Permalink
cpplint
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihai Budiu committed Apr 16, 2020
1 parent e952c14 commit 5d72226
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 3 additions & 2 deletions frontends/p4/moveDeclarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ class MoveDeclarations : public Transform {
class MoveInitializers : public Transform {
ReferenceMap* refMap;
IR::IndexedVector<IR::StatOrDecl> *toMove; // This contains just IR::AssignmentStatement
const IR::ParserState* oldStart; // nullptr if we do not want to rename the start state
const IR::ParserState* oldStart; // nullptr if we do not want to rename the start state
cstring newStartName; // name allocated to the old start state

public:
MoveInitializers(ReferenceMap* refMap): refMap(refMap), oldStart(nullptr), newStartName("") {
explicit MoveInitializers(ReferenceMap* refMap):
refMap(refMap), oldStart(nullptr), newStartName("") {
setName("MoveInitializers"); CHECK_NULL(refMap);
toMove = new IR::IndexedVector<IR::StatOrDecl>(); }
const IR::Node* preorder(IR::P4Parser* parser) override;
Expand Down
6 changes: 5 additions & 1 deletion testdata/p4_16_samples_outputs/issue281-frontend.p4
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ struct m {
parser MyParser(packet_in b, out h hdr, inout m meta, inout standard_metadata_t std) {
bit<16> l3_etherType;
state start {
transition start_0;
}
state start_0 {
hdr.ether.setInvalid();
hdr.vlan.setInvalid();
hdr.ipv4.setInvalid();
Expand Down Expand Up @@ -92,7 +95,8 @@ parser MyParser(packet_in b, out h hdr, inout m meta, inout standard_metadata_t
transition L3_vlan_0;
}
state L3_vlan_0 {
transition L3_start;
l3_etherType = hdr.vlan.etherType;
transition L3_start_0;
}
state start_3 {
transition accept;
Expand Down
11 changes: 7 additions & 4 deletions testdata/p4_16_samples_outputs/issue281-midend.p4
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,18 @@ struct m {
}

parser MyParser(packet_in b, out h hdr, inout m meta, inout standard_metadata_t std) {
bit<16> l3_etherType;
state start {
hdr.ether.setInvalid();
hdr.vlan.setInvalid();
hdr.ipv4.setInvalid();
hdr.ether.setInvalid();
b.extract<ethernet_t>(hdr.ether);
transition L3_start;
l3_etherType = hdr.ether.etherType;
transition L3_start_0;
}
state L3_start {
transition select(hdr.ether.etherType) {
state L3_start_0 {
transition select(l3_etherType) {
16w0x800: L3_ipv4;
16w0x8100: L3_vlan;
default: start_3;
Expand All @@ -63,7 +65,8 @@ parser MyParser(packet_in b, out h hdr, inout m meta, inout standard_metadata_t
state L3_vlan {
hdr.vlan.setInvalid();
b.extract<vlan_t>(hdr.vlan);
transition L3_start;
l3_etherType = hdr.vlan.etherType;
transition L3_start_0;
}
state start_3 {
transition accept;
Expand Down

0 comments on commit 5d72226

Please sign in to comment.