================
@@ -0,0 +1,51 @@
+// RUN: %check_clang_tidy --match-partial-fixes %s llvm-mlir-op-builder %t
+
+namespace mlir {
+class Location {};
+class OpBuilder {
+public:
+ template <typename OpTy, typename... Args>
+ OpTy create(Location location, Args &&...args) {
+ return OpTy(args...);
+ }
+ Location getUnknownLoc() { return Location(); }
+};
+class ImplicitLocOpBuilder : public OpBuilder {
+public:
+ template <typename OpTy, typename... Args>
+ OpTy create(Args &&...args) {
+ return OpTy(args...);
+ }
+};
+struct ModuleOp {
+ ModuleOp() {}
+ static ModuleOp create(OpBuilder &builder, Location location) {
+ return ModuleOp();
+ }
+};
+struct NamedOp {
+ NamedOp(const char* name) {}
+ static NamedOp create(OpBuilder &builder, Location location, const char*
name) {
+ return NamedOp(name);
+ }
+};
+} // namespace mlir
+
+void f() {
----------------
vbvictor wrote:
Could you add tests with `builder.create`
- inside macros
- inside template functions when template parameter of `create` is dependent.
- when `builder.create` is in multiple lines like:
```cpp
builder.
create<NamedOp>(
builder.getUnknownLoc(),
"baz");
```
https://github.com/llvm/llvm-project/pull/149148
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits