@@ -621,27 +621,6 @@ LogicalResult emitc::YieldOp::verify() {
621
621
#define GET_ATTRDEF_CLASSES
622
622
#include " mlir/Dialect/EmitC/IR/EmitCAttributes.cpp.inc"
623
623
624
- Attribute emitc::OpaqueAttr::parse (AsmParser &parser, Type type) {
625
- if (parser.parseLess ())
626
- return Attribute ();
627
- std::string value;
628
- SMLoc loc = parser.getCurrentLocation ();
629
- if (parser.parseOptionalString (&value)) {
630
- parser.emitError (loc) << " expected string" ;
631
- return Attribute ();
632
- }
633
- if (parser.parseGreater ())
634
- return Attribute ();
635
-
636
- return get (parser.getContext (), value);
637
- }
638
-
639
- void emitc::OpaqueAttr::print (AsmPrinter &printer) const {
640
- printer << " <\" " ;
641
- llvm::printEscapedString (getValue (), printer.getStream ());
642
- printer << " \" >" ;
643
- }
644
-
645
624
// ===----------------------------------------------------------------------===//
646
625
// EmitC Types
647
626
// ===----------------------------------------------------------------------===//
@@ -653,27 +632,15 @@ void emitc::OpaqueAttr::print(AsmPrinter &printer) const {
653
632
// OpaqueType
654
633
// ===----------------------------------------------------------------------===//
655
634
656
- Type emitc::OpaqueType::parse (AsmParser &parser) {
657
- if (parser.parseLess ())
658
- return Type ();
659
- std::string value;
660
- SMLoc loc = parser.getCurrentLocation ();
661
- if (parser.parseOptionalString (&value) || value.empty ()) {
662
- parser.emitError (loc) << " expected non empty string in !emitc.opaque type" ;
663
- return Type ();
635
+ LogicalResult mlir::emitc::OpaqueType::verify (
636
+ llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
637
+ llvm::StringRef value) {
638
+ if (value.empty ()) {
639
+ return emitError () << " expected non empty string in !emitc.opaque type" ;
664
640
}
665
641
if (value.back () == ' *' ) {
666
- parser.emitError (loc) << " pointer not allowed as outer type with "
667
- " !emitc.opaque, use !emitc.ptr instead" ;
668
- return Type ();
642
+ return emitError () << " pointer not allowed as outer type with "
643
+ " !emitc.opaque, use !emitc.ptr instead" ;
669
644
}
670
- if (parser.parseGreater ())
671
- return Type ();
672
- return get (parser.getContext (), value);
673
- }
674
-
675
- void emitc::OpaqueType::print (AsmPrinter &printer) const {
676
- printer << " <\" " ;
677
- llvm::printEscapedString (getValue (), printer.getStream ());
678
- printer << " \" >" ;
645
+ return success ();
679
646
}
0 commit comments