Commit 490cf97
[mlir] Add the ability to override attribute parsing/printing in attr-dicts
This adds a `parseNamedAttrFn` callback to
`AsmParser::parseOptionalAttrDict()`.
If parseNamedAttrFn is provided the default parsing can be overridden
for a named attribute. parseNamedAttrFn is passed the name of an
attribute, if it can parse the attribute it returns the parsed
attribute, otherwise, it returns `failure()` which indicates that
generic parsing should be used. Note: Returning a null Attribute from
parseNamedAttrFn indicates a parser error.
It also adds `printNamedAttrFn` to
`AsmPrinter::printOptionalAttrDict()`.
If printNamedAttrFn is provided the default printing can be overridden
for a named attribute. printNamedAttrFn is passed a NamedAttribute, if
it prints the attribute it returns `success()`, otherwise, it returns
`failure()` which indicates that generic printing should be used.1 parent 93f5c61 commit 490cf97
File tree
5 files changed
+71
-24
lines changed- mlir
- include/mlir/IR
- lib
- AsmParser
- IR
5 files changed
+71
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
466 | | - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
467 | 471 | | |
468 | | - | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
469 | 475 | | |
470 | 476 | | |
471 | 477 | | |
| |||
1116 | 1122 | | |
1117 | 1123 | | |
1118 | 1124 | | |
1119 | | - | |
1120 | | - | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
1121 | 1136 | | |
1122 | 1137 | | |
1123 | 1138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
462 | 465 | | |
463 | 466 | | |
464 | | - | |
| 467 | + | |
465 | 468 | | |
466 | 469 | | |
467 | 470 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
| |||
329 | 331 | | |
330 | 332 | | |
331 | 333 | | |
332 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
333 | 345 | | |
334 | 346 | | |
335 | 347 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
260 | 262 | | |
261 | 263 | | |
262 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
459 | 462 | | |
460 | 463 | | |
461 | 464 | | |
| |||
780 | 783 | | |
781 | 784 | | |
782 | 785 | | |
783 | | - | |
784 | | - | |
785 | | - | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
786 | 790 | | |
787 | 791 | | |
788 | 792 | | |
| |||
2687 | 2691 | | |
2688 | 2692 | | |
2689 | 2693 | | |
2690 | | - | |
2691 | | - | |
2692 | | - | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
2693 | 2698 | | |
2694 | 2699 | | |
2695 | 2700 | | |
| |||
2702 | 2707 | | |
2703 | 2708 | | |
2704 | 2709 | | |
2705 | | - | |
2706 | | - | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
2707 | 2713 | | |
2708 | 2714 | | |
2709 | 2715 | | |
| |||
2720 | 2726 | | |
2721 | 2727 | | |
2722 | 2728 | | |
2723 | | - | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
2724 | 2732 | | |
2725 | 2733 | | |
2726 | 2734 | | |
| |||
2729 | 2737 | | |
2730 | 2738 | | |
2731 | 2739 | | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
2732 | 2744 | | |
2733 | 2745 | | |
2734 | 2746 | | |
| |||
3149 | 3161 | | |
3150 | 3162 | | |
3151 | 3163 | | |
3152 | | - | |
3153 | | - | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
3154 | 3169 | | |
3155 | 3170 | | |
3156 | 3171 | | |
| |||
0 commit comments