20 if (failed(parseResult)) {
21 return parser.emitError(parser.getCurrentLocation(),
"failed to parse struct parameters");
23 auto emitError = [&parser] {
26 FailureOr<SmallVector<Attribute>> res =
forceIntAttrTypes(parseResult->getValue(), emitError);
30 value = parser.getBuilder().getArrayAttr(*res);
41 function_ref<InFlightDiagnostic()> emitError, SymbolRefAttr nameRef, ArrayAttr params
46FailureOr<SymbolLookupResult<StructDefOp>>
55 if (failed(res) || !res.value()) {
61 auto defParams = res.value().get().getConstParams();
62 size_t numExpected = defParams ? defParams->size() : 0;
63 if (typeParams.size() != numExpected) {
64 return op->emitError() <<
'\'' <<
StructType::name <<
"' type has " << typeParams.size()
65 <<
" parameters but \"" << res.value().get().getSymName()
66 <<
"\" expects " << numExpected;
81 return lookup->get().hasColumns();
Wrapper around InFlightDiagnostic that can either be a regular InFlightDiagnostic or a special versio...
static constexpr ::llvm::StringLiteral getOperationName()
::mlir::SymbolRefAttr getNameRef() const
mlir::LogicalResult hasColumns(mlir::SymbolTableCollection &symbolTable, mlir::Operation *op) const
Returns wether the struct this type refers to has fields marked as columns.
::llvm::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::SymbolRefAttr nameRef, ::mlir::ArrayAttr params)
::mlir::ArrayAttr getParams() const
::mlir::FailureOr< SymbolLookupResult< StructDefOp > > getDefinition(::mlir::SymbolTableCollection &symbolTable, ::mlir::Operation *op) const
Gets the struct op that defines this struct.
::mlir::LogicalResult verifySymbolRef(::mlir::SymbolTableCollection &symbolTable, ::mlir::Operation *op)
static constexpr ::llvm::StringLiteral name
void printStructParams(AsmPrinter &printer, ArrayAttr value)
ParseResult parseStructParams(AsmParser &parser, ArrayAttr &value)
mlir::FailureOr< SymbolLookupResultUntyped > lookupTopLevelSymbol(mlir::SymbolTableCollection &tables, mlir::SymbolRefAttr symbol, mlir::Operation *origin, bool reportMissing=true)
void printAttrs(AsmPrinter &printer, ArrayRef< Attribute > attrs, const StringRef &separator)
FailureOr< SmallVector< Attribute > > forceIntAttrTypes(ArrayRef< Attribute > attrList, EmitErrorFn emitError)
OwningEmitErrorFn wrapNonNullableInFlightDiagnostic(llvm::function_ref< mlir::InFlightDiagnostic()> emitError)
LogicalResult verifyStructTypeParams(EmitErrorFn emitError, ArrayAttr params)