diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td index 652426db6202..ed654121fbfa 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIROps.td +++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td @@ -3597,12 +3597,6 @@ def FuncOp : CIR_Op<"func", [ return getFunctionType().getReturnTypes(); } - /// Hook for OpTrait::FunctionOpInterfaceTrait, called after verifying that - /// the 'type' attribute is present and checks if it holds a function type. - /// Ensures getType, getNumFuncArguments, and getNumFuncResults can be - /// called safely. - llvm::LogicalResult verifyType(); - //===------------------------------------------------------------------===// // SymbolOpInterface Methods //===------------------------------------------------------------------===// diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp index 4c310afb0ee1..ba815044e043 100644 --- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp @@ -2588,25 +2588,6 @@ void cir::FuncOp::print(OpAsmPrinter &p) { } } -// Hook for OpTrait::FunctionLike, called after verifying that the 'type' -// attribute is present. This can check for preconditions of the -// getNumArguments hook not failing. -LogicalResult cir::FuncOp::verifyType() { - auto type = getFunctionType(); - if (!isa(type)) - return emitOpError("requires '" + getFunctionTypeAttrName().str() + - "' attribute of function type"); - if (!getNoProto() && type.isVarArg() && type.getNumInputs() == 0) - return emitError() - << "prototyped function must have at least one non-variadic input"; - if (auto rt = type.getReturnTypes(); - !rt.empty() && mlir::isa(rt.front())) - return emitOpError("The return type for a function returning void should " - "be empty instead of an explicit !cir.void"); - - return success(); -} - // Verifies linkage types // - functions don't have 'common' linkage // - external functions have 'external' or 'extern_weak' linkage diff --git a/clang/test/CIR/IR/invalid.cir b/clang/test/CIR/IR/invalid.cir index fa4b023013c2..ea8e2a11a979 100644 --- a/clang/test/CIR/IR/invalid.cir +++ b/clang/test/CIR/IR/invalid.cir @@ -623,13 +623,6 @@ module { // ----- -module { - // expected-error@+1 {{prototyped function must have at least one non-variadic input}} - cir.func private @variadic(...) -> !cir.int -} - -// ----- - module { // expected-error@+1 {{custom op 'cir.func' variadic arguments must be in the end of the argument list}} cir.func @variadic(..., !cir.int) -> !cir.int