<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55322>55322</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [mlir] ODS useDefaultAttributePrinterParser does not seem to generate declarations
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir:core
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          stellaraccident
      </td>
    </tr>
</table>

<pre>
    Encountered on [D124318](https://reviews.llvm.org/D124318#inline-1199257), it seems insufficient to just set `useDefaultAttributePrinterParser` on its own. This results in a compiler error like:

```
In file included from /home/stella/src/llvm-project/mlir/lib/Dialect/MLProgram/IR/MLProgramDialect.cpp:22:
tools/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc:99:37: error: out-of-line definition of 'parseAttribute' does not match any declaration in 'mlir::ml_program::MLProgramDialect'
::mlir::Attribute MLProgramDialect::parseAttribute(::mlir::DialectAsmParser &parser,
                                    ^~~~~~~~~~~~~~
tools/mlir/include/mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc:117:24: error: out-of-line definition of 'printAttribute' does not match any declaration in 'mlir::ml_program::MLProgramDialect'
void MLProgramDialect::printAttribute(::mlir::Attribute attr,
```

The workaround (which seems to have been done a couple of times I found in downstreams) is to explicitly declare:

```
  let extraClassDeclaration = [{
  private:
    Attribute parseAttribute(DialectAsmParser& parser, Type type) const override;
    void printAttribute(Attribute attr, DialectAsmPrinter& p) const override;

  public:
  }];
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9VdGOmzoQ_Rp4GW1ETAjhgYfdpZVW6tVd9e77lYEhuDU2sk3S_fuOgZA0UbvbhzZCjjEz4znnjMelrl_zD6rSg3JosAatIEgeijXbxOtdkBQB27XO9TaI7wP2kR6DB4FHu5Ly0K202dPSyZrFQkmh8G69zjKWpAHLAvY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