@@ -2621,34 +2621,17 @@ ParseResult cir::FuncOp::parse(OpAsmParser &parser, OperationState &state) {
2621
2621
}
2622
2622
2623
2623
// Parse CXXSpecialMember attribute
2624
- if (mlir::succeeded (parser.parseOptionalKeyword (" cxx_ctor" ))) {
2624
+ if (parser.parseOptionalKeyword (" special_member" ).succeeded ()) {
2625
+ cir::CXXCtorAttr ctorAttr;
2626
+ cir::CXXDtorAttr dtorAttr;
2625
2627
if (parser.parseLess ().failed ())
2626
2628
return failure ();
2627
- mlir::Type type;
2628
- if (parser.parseType (type).failed ())
2629
- return failure ();
2630
- if (parser.parseComma ().failed ())
2631
- return failure ();
2632
- cir::CtorKind ctorKind;
2633
- if (parseCIRKeyword<cir::CtorKind>(parser, ctorKind).failed ())
2634
- return failure ();
2635
- if (parser.parseGreater ().failed ())
2636
- return failure ();
2637
-
2638
- state.addAttribute (cxxSpecialMemberAttr,
2639
- cir::CXXCtorAttr::get (type, ctorKind));
2640
- }
2641
-
2642
- if (mlir::succeeded (parser.parseOptionalKeyword (" cxx_dtor" ))) {
2643
- if (parser.parseLess ().failed ())
2644
- return failure ();
2645
- mlir::Type type;
2646
- if (parser.parseType (type).failed ())
2647
- return failure ();
2629
+ if (auto oa = parser.parseOptionalAttribute (ctorAttr); oa.has_value ())
2630
+ state.addAttribute (cxxSpecialMemberAttr, ctorAttr);
2631
+ if (auto oa = parser.parseOptionalAttribute (dtorAttr); oa.has_value ())
2632
+ state.addAttribute (cxxSpecialMemberAttr, dtorAttr);
2648
2633
if (parser.parseGreater ().failed ())
2649
2634
return failure ();
2650
-
2651
- state.addAttribute (cxxSpecialMemberAttr, cir::CXXDtorAttr::get (type));
2652
2635
}
2653
2636
2654
2637
// If additional attributes are present, parse them.
@@ -2833,12 +2816,14 @@ void cir::FuncOp::print(OpAsmPrinter &p) {
2833
2816
2834
2817
if (getCxxSpecialMember ()) {
2835
2818
if (auto cxxCtor = dyn_cast<cir::CXXCtorAttr>(*getCxxSpecialMember ())) {
2836
- if (cxxCtor. getCtorKind () != cir::CtorKind::Custom)
2837
- p << " cxx_ctor< " << cxxCtor. getType () << " , " << cxxCtor. getCtorKind ()
2838
- << " > " ;
2819
+ p << " special_member< " ;
2820
+ p. printAttribute ( cxxCtor);
2821
+ p << ' > ' ;
2839
2822
} else if (auto cxxDtor =
2840
2823
dyn_cast<cir::CXXDtorAttr>(*getCxxSpecialMember ())) {
2841
- p << " cxx_dtor<" << cxxDtor.getType () << " >" ;
2824
+ p << " special_member<" ;
2825
+ p.printAttribute (cxxDtor);
2826
+ p << ' >' ;
2842
2827
} else {
2843
2828
assert (false && " expected a CXX special member" );
2844
2829
}
0 commit comments