@@ -636,27 +636,6 @@ LogicalResult emitc::YieldOp::verify() {
636
636
#define GET_ATTRDEF_CLASSES
637
637
#include " mlir/Dialect/EmitC/IR/EmitCAttributes.cpp.inc"
638
638
639
- Attribute emitc::OpaqueAttr::parse (AsmParser &parser, Type type) {
640
- if (parser.parseLess ())
641
- return Attribute ();
642
- std::string value;
643
- SMLoc loc = parser.getCurrentLocation ();
644
- if (parser.parseOptionalString (&value)) {
645
- parser.emitError (loc) << " expected string" ;
646
- return Attribute ();
647
- }
648
- if (parser.parseGreater ())
649
- return Attribute ();
650
-
651
- return get (parser.getContext (), value);
652
- }
653
-
654
- void emitc::OpaqueAttr::print (AsmPrinter &printer) const {
655
- printer << " <\" " ;
656
- llvm::printEscapedString (getValue (), printer.getStream ());
657
- printer << " \" >" ;
658
- }
659
-
660
639
// ===----------------------------------------------------------------------===//
661
640
// EmitC Types
662
641
// ===----------------------------------------------------------------------===//
@@ -731,27 +710,15 @@ emitc::ArrayType::cloneWith(std::optional<ArrayRef<int64_t>> shape,
731
710
// OpaqueType
732
711
// ===----------------------------------------------------------------------===//
733
712
734
- Type emitc::OpaqueType::parse (AsmParser &parser) {
735
- if (parser.parseLess ())
736
- return Type ();
737
- std::string value;
738
- SMLoc loc = parser.getCurrentLocation ();
739
- if (parser.parseOptionalString (&value) || value.empty ()) {
740
- parser.emitError (loc) << " expected non empty string in !emitc.opaque type" ;
741
- return Type ();
713
+ LogicalResult mlir::emitc::OpaqueType::verify (
714
+ llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
715
+ llvm::StringRef value) {
716
+ if (value.empty ()) {
717
+ return emitError () << " expected non empty string in !emitc.opaque type" ;
742
718
}
743
719
if (value.back () == ' *' ) {
744
- parser.emitError (loc) << " pointer not allowed as outer type with "
745
- " !emitc.opaque, use !emitc.ptr instead" ;
746
- return Type ();
720
+ return emitError () << " pointer not allowed as outer type with "
721
+ " !emitc.opaque, use !emitc.ptr instead" ;
747
722
}
748
- if (parser.parseGreater ())
749
- return Type ();
750
- return get (parser.getContext (), value);
751
- }
752
-
753
- void emitc::OpaqueType::print (AsmPrinter &printer) const {
754
- printer << " <\" " ;
755
- llvm::printEscapedString (getValue (), printer.getStream ());
756
- printer << " \" >" ;
723
+ return success ();
757
724
}
0 commit comments