@@ -673,12 +673,11 @@ bool CollectTableInfo::preorder(const IR::Key *keys) {
673
673
674
674
const IR::Node *InjectJumboStruct::preorder (IR::Type_Struct *s) {
675
675
if (s->name == structure->local_metadata_type ) {
676
- auto *annotations = new IR::Annotations ( {new IR::Annotation (IR::ID (" __metadata__" ), {})});
677
- return new IR::Type_Struct (s-> name , annotations, structure->compiler_added_fields );
676
+ return new IR::Type_Struct (s-> name , {new IR::Annotation (IR::ID (" __metadata__" ), {})},
677
+ structure->compiler_added_fields );
678
678
} else if (s->name == structure->header_type ) {
679
- auto *annotations =
680
- new IR::Annotations ({new IR::Annotation (IR::ID (" __packet_data__" ), {})});
681
- return new IR::Type_Struct (s->name , annotations, s->fields );
679
+ return new IR::Type_Struct (s->name , {new IR::Annotation (IR::ID (" __packet_data__" ), {})},
680
+ s->fields );
682
681
}
683
682
return s;
684
683
}
@@ -1835,13 +1834,12 @@ std::tuple<const IR::P4Table *, cstring, cstring> SplitP4TableCommon::create_mat
1835
1834
1836
1835
const IR::P4Action *SplitP4TableCommon::create_action (cstring actionName, cstring group_id,
1837
1836
cstring param) {
1838
- auto hidden = new IR::Annotations ();
1839
- hidden->add (new IR::Annotation (IR::Annotation::hiddenAnnotation, {}));
1840
1837
auto set_id = new IR::AssignmentStatement (new IR::PathExpression (group_id),
1841
1838
new IR::PathExpression (param));
1842
1839
auto parameter = new IR::Parameter (param, IR::Direction::None, IR::Type_Bits::get (32 ));
1843
- auto action = new IR::P4Action (actionName, hidden, new IR::ParameterList ({parameter}),
1844
- new IR::BlockStatement ({set_id}));
1840
+ auto action =
1841
+ new IR::P4Action (actionName, {new IR::Annotation (IR::Annotation::hiddenAnnotation, {})},
1842
+ new IR::ParameterList ({parameter}), new IR::BlockStatement ({set_id}));
1845
1843
return action;
1846
1844
}
1847
1845
@@ -1856,12 +1854,11 @@ const IR::P4Table *SplitP4TableCommon::create_member_table(const IR::P4Table *tb
1856
1854
IR::IndexedVector<IR::Property> member_properties;
1857
1855
member_properties.push_back (new IR::Property (" key" , new IR::Key (member_keys), false ));
1858
1856
1859
- auto hidden = new IR::Annotations ();
1860
- hidden->add (new IR::Annotation (IR::Annotation::hiddenAnnotation, {}));
1857
+ IR::Vector<IR::Annotation> hidden (new IR::Annotation (IR::Annotation::hiddenAnnotation, {}));
1861
1858
auto nameAnnon = tbl->getAnnotation (IR::Annotation::nameAnnotation);
1862
1859
cstring nameA = nameAnnon->getSingleString ();
1863
1860
cstring memName = nameA.replace (nameA.findlast (' .' ), " ." + memberTableName);
1864
- hidden-> addAnnotation (IR::Annotation::nameAnnotation, new IR::StringLiteral ( memName), false );
1861
+ hidden. emplace_back (IR::Annotation::nameAnnotation, memName);
1865
1862
1866
1863
IR::IndexedVector<IR::ActionListElement> memberActionList;
1867
1864
for (auto action : tbl->getActionList ()->actionList ) memberActionList.push_back (action);
@@ -1874,10 +1871,8 @@ const IR::P4Table *SplitP4TableCommon::create_member_table(const IR::P4Table *tb
1874
1871
member_properties.push_back (new IR::Property (
1875
1872
" default_action" , new IR::ExpressionValue (tbl->getDefaultAction ()), false ));
1876
1873
1877
- auto member_table =
1878
- new IR::P4Table (memberTableName, hidden, new IR::TableProperties (member_properties));
1879
-
1880
- return member_table;
1874
+ return new IR::P4Table (memberTableName, std::move (hidden),
1875
+ new IR::TableProperties (member_properties));
1881
1876
}
1882
1877
1883
1878
const IR::P4Table *SplitP4TableCommon::create_group_table (const IR::P4Table *tbl,
@@ -1891,12 +1886,11 @@ const IR::P4Table *SplitP4TableCommon::create_group_table(const IR::P4Table *tbl
1891
1886
selector_keys.push_back (key);
1892
1887
}
1893
1888
}
1894
- auto hidden = new IR::Annotations ();
1895
- hidden->add (new IR::Annotation (IR::Annotation::hiddenAnnotation, {}));
1889
+ IR::Vector<IR::Annotation> hidden (new IR::Annotation (IR::Annotation::hiddenAnnotation, {}));
1896
1890
auto nameAnnon = tbl->getAnnotation (IR::Annotation::nameAnnotation);
1897
1891
cstring nameA = nameAnnon->getSingleString ();
1898
1892
cstring selName = nameA.replace (nameA.findlast (' .' ), " ." + selectorTableName);
1899
- hidden-> addAnnotation (IR::Annotation::nameAnnotation, new IR::StringLiteral ( selName), false );
1893
+ hidden. emplace_back (IR::Annotation::nameAnnotation, selName);
1900
1894
IR::IndexedVector<IR::Property> selector_properties;
1901
1895
selector_properties.push_back (new IR::Property (" selector" , new IR::Key (selector_keys), false ));
1902
1896
selector_properties.push_back (new IR::Property (
@@ -2908,8 +2902,8 @@ const IR::Node *ElimHeaderCopy::postorder(IR::Member *m) {
2908
2902
2909
2903
const IR::Node *DpdkAddPseudoHeaderDecl::preorder (IR::P4Program *program) {
2910
2904
if (is_all_args_header) return program;
2911
- auto *annotations = new IR::Annotations ({ new IR::Annotation ( IR::ID ( " __pseudo_header__ " ), {})});
2912
- const IR::Type_Header *pseudo_hdr = new IR::Type_Header (pseudoHeaderTypeName, annotations );
2905
+ const IR::Type_Header *pseudo_hdr = new IR::Type_Header (
2906
+ pseudoHeaderTypeName, { new IR::Annotation ( IR::ID ( " __pseudo_header__ " ), {})} );
2913
2907
allTypeDecls.push_back (pseudo_hdr);
2914
2908
allTypeDecls.append (program->objects );
2915
2909
program->objects = allTypeDecls;
@@ -2922,11 +2916,9 @@ const IR::Node *DpdkAddPseudoHeaderDecl::preorder(IR::Type_Struct *st) {
2922
2916
bool header_found = isHeadersStruct (st);
2923
2917
if (header_found) {
2924
2918
IR::IndexedVector<IR::StructField> fields;
2925
- auto *annotations =
2926
- new IR::Annotations ({new IR::Annotation (IR::ID (" __pseudo_header__" ), {})});
2927
2919
auto *type = new IR::Type_Name (new IR::Path (pseudoHeaderTypeName));
2928
- const IR::StructField *new_field1 =
2929
- new IR::StructField (pseudoHeaderInstanceName, annotations , type);
2920
+ const IR::StructField *new_field1 = new IR::StructField (
2921
+ pseudoHeaderInstanceName, { new IR::Annotation ( IR::ID ( " __pseudo_header__ " ), {})} , type);
2930
2922
fields = st->fields ;
2931
2923
fields.push_back (new_field1);
2932
2924
auto *st1 =
0 commit comments