[Mlir-commits] [mlir] [mlir][emitc] Add a `declare_func` operation (PR #80297)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Feb 1 09:50:03 PST 2024


================
@@ -393,6 +393,24 @@ FunctionType CallOp::getCalleeType() {
   return FunctionType::get(getContext(), getOperandTypes(), getResultTypes());
 }
 
+//===----------------------------------------------------------------------===//
+// DeclareFuncOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult
+DeclareFuncOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
+  // Check that the callee attribute was specified.
+  auto fnAttr = (*this)->getAttrOfType<FlatSymbolRefAttr>("callee");
+  if (!fnAttr)
+    return emitOpError("requires a 'callee' symbol reference attribute");
----------------
AlexDenisov wrote:

It's better to use `getCalleeAttrName()` around these lines to ensure that the messages are consistent.

https://github.com/llvm/llvm-project/pull/80297


More information about the Mlir-commits mailing list