Hi, i have a DSL written on top of mlir. When refactoring the operations definitions i have then to fix the various points where they get built.
Since clangd can’t get figure out the correct overload available for IRBuilder::create this means that I have to try to compile the project, get hit by errors that look like
home/massimo/rlc-infrastructure/llvm-install-debug/include/mlir/IR/Builders.h:512:5: error: no matching function for call to 'build'
512 | OpTy::build(*this, state, std::forward<Args>(args)...);
| ^~~~~~~~~~~
/home/massimo/rlc-infrastructure/llvm-install-debug/include/mlir/IR/PatternMatch.h:537:18: note: in instantiation of function template specialization 'mlir::OpBuilder::create<mlir::rlc::ClassDeclaration, mlir::rlc::ClassType &, llvm::StringRef, mlir::ArrayAttr, mlir::ArrayAttr>' requested here
537 | auto newOp = create<OpTy>(op->getLoc(), std::forward<Args>(args)...);
| ^
/home/massimo/rlc-infrastructure/rlc/lib/dialect/src/TypeCheck.cpp:306:18: note: in instantiation of function template specialization 'mlir::RewriterBase::replaceOpWithNewOp<mlir::rlc::ClassDeclaration, mlir::rlc::ClassType &, llvm::StringRef, mlir::ArrayAttr, mlir::ArrayAttr>' requested here
306 | decl = rewriter.replaceOpWithNewOp<mlir::rlc::ClassDeclaration>(
| ^
/home/massimo/rlc-infrastructure/rlc-debug/lib/dialect/include/rlc/dialect/Operations.inc:5181:15: note: candidate function not viable: no known conversion from 'mlir::rlc::ClassType' to 'llvm::StringRef' for 3rd argument
5181 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, llvm::StringRef name, mlir::rlc::ClassFieldAttr members, mlir::TypeRange template_parameters, mlir::rlc::SourceRangeAttr type_location);
| ^ ~~~~~~~~~~~~~~~~~~~~
/home/massimo/rlc-infrastructure/rlc-debug/lib/dialect/include/rlc/dialect/Operations.inc:5186:15: note: candidate function not viable: requires at most 5 arguments, but 6 were provided
5186 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/massimo/rlc-infrastructure/rlc-debug/lib/dialect/include/rlc/dialect/Operations.inc:5182:15: note: candidate function not viable: requires 7 arguments, but 6 were provided
5182 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::StringAttr name, ::mlir::ArrayAttr members, ::mlir::ArrayAttr template_parameters, /*optional*/::mlir::rlc::SourceRangeAttr type_location);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/massimo/rlc-infrastructure/rlc-debug/lib/dialect/include/rlc/dialect/Operations.inc:5183:15: note: candidate function not viable: requires 7 arguments, but 6 were provided
5183 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr name, ::mlir::ArrayAttr members, ::mlir::ArrayAttr template_parameters, /*optional*/::mlir::rlc::SourceRangeAttr type_location);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/massimo/rlc-infrastructure/rlc-debug/lib/dialect/include/rlc/dialect/Operations.inc:5184:15: note: candidate function not viable: requires 7 arguments, but 6 were provided
5184 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef name, ::mlir::ArrayAttr members, ::mlir::ArrayAttr template_parameters, /*optional*/::mlir::rlc::SourceRangeAttr type_location);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/massimo/rlc-infrastructure/rlc-debug/lib/dialect/include/rlc/dialect/Operations.inc:5185:15: note: candidate function not viable: requires 7 arguments, but 6 were provided
5185 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name, ::mlir::ArrayAttr members, ::mlir::ArrayAttr template_parameters, /*optional*/::mlir::rlc::SourceRangeAttr type_location);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
then i have to understand what is the location of the real error, go there, figure out why a parameter is not the right one, and keep doing this for the entire project.
This issue would be entirely solved if it would be possible to generate a IRBuilder specific to my dialect that knows about the operations and their build overload and hides the templated invocation. This would probably cut down at least 50% of the time it takes me to change the operation definitions.
i understand there was a proposal to do something in this realm [RFC] DSL-style / dialect-specific builders , but i don’t think it went anywhere.
Is there any plan to address this issue?