/// whether the function is variadic. If the builder returns a null type,
/// `result` will not contain the `type` attribute. The caller can then add a
/// type, report the error or delegate the reporting to the op's verifier.
-/// If `allowInlineVisibility` is true, then the parser will allow visibility
-/// to be specified after the operation name. If the visibility is not specified
-/// there or `allowInlineVisibility` is false, visibility will be allowed in the
-/// attribute dict.
ParseResult parseFunctionLikeOp(OpAsmParser &parser, OperationState &result,
bool allowVariadic,
- FuncTypeBuilder funcTypeBuilder,
- bool allowInlineVisibility = false);
+ FuncTypeBuilder funcTypeBuilder);
/// Printer implementation for function-like operations. Accepts lists of
-/// argument and result types to use while printing. If `printVisibilityInline`
-/// is true, visibility is printed "inline" after the operation name and elided
-/// from the attributes dict. Otherwise, it is printed in the attribute dict.
+/// argument and result types to use while printing.
void printFunctionLikeOp(OpAsmPrinter &p, Operation *op,
ArrayRef<Type> argTypes, bool isVariadic,
- ArrayRef<Type> resultTypes,
- bool printVisibilityInline = false);
+ ArrayRef<Type> resultTypes);
/// Prints the signature of the function-like operation `op`. Assumes `op` has
/// the FunctionLike trait and passed the verification.
};
return impl::parseFunctionLikeOp(parser, result, /*allowVariadic=*/false,
- buildFuncType,
- /*allowInlineVisibility=*/true);
+ buildFuncType);
}
void FuncOp::print(OpAsmPrinter &p) {
FunctionType fnType = getType();
impl::printFunctionLikeOp(p, *this, fnType.getInputs(), /*isVariadic=*/false,
- fnType.getResults(),
- /*printVisibilityInline=*/true);
+ fnType.getResults());
}
LogicalResult FuncOp::verify() {
/// Parser implementation for function-like operations. Uses `funcTypeBuilder`
/// to construct the custom function type given lists of input and output types.
-ParseResult mlir::impl::parseFunctionLikeOp(
- OpAsmParser &parser, OperationState &result, bool allowVariadic,
- mlir::impl::FuncTypeBuilder funcTypeBuilder, bool allowInlineVisibility) {
+ParseResult
+mlir::impl::parseFunctionLikeOp(OpAsmParser &parser, OperationState &result,
+ bool allowVariadic,
+ mlir::impl::FuncTypeBuilder funcTypeBuilder) {
SmallVector<OpAsmParser::OperandType, 4> entryArgs;
SmallVector<NamedAttrList, 4> argAttrs;
SmallVector<NamedAttrList, 4> resultAttrs;
SmallVector<Type, 4> resultTypes;
auto &builder = parser.getBuilder();
- // Parse visibility if inline visibility is allowed.
- if (allowInlineVisibility)
- impl::parseOptionalVisibilityKeyword(parser, result.attributes);
+ // Parse visibility.
+ impl::parseOptionalVisibilityKeyword(parser, result.attributes);
// Parse the name as a symbol.
StringAttr nameAttr;
/// argument and result types to use while printing.
void mlir::impl::printFunctionLikeOp(OpAsmPrinter &p, Operation *op,
ArrayRef<Type> argTypes, bool isVariadic,
- ArrayRef<Type> resultTypes,
- bool printVisibilityInline) {
+ ArrayRef<Type> resultTypes) {
// Print the operation and the function name.
auto funcName =
op->getAttrOfType<StringAttr>(SymbolTable::getSymbolAttrName())
.getValue();
p << op->getName() << ' ';
- StringRef elidedAttr;
- if (printVisibilityInline) {
- elidedAttr = SymbolTable::getVisibilityAttrName();
- if (auto visibility = op->getAttrOfType<StringAttr>(elidedAttr))
- p << visibility.getValue() << ' ';
- }
+
+ StringRef visibilityAttrName = SymbolTable::getVisibilityAttrName();
+ if (auto visibility = op->getAttrOfType<StringAttr>(visibilityAttrName))
+ p << visibility.getValue() << ' ';
p.printSymbolName(funcName);
printFunctionSignature(p, op, argTypes, isVariadic, resultTypes);
printFunctionAttributes(p, op, argTypes.size(), resultTypes.size(),
- {elidedAttr});
+ {visibilityAttrName});
// Print the body if this is not an external function.
Region &body = op->getRegion(0);
if (!body.empty())