Skip to content

Commit 95f9b08

Browse files
author
Simon Camphausen
authored
[mlir][EmitC] Fix examples in op descriptions (#87478)
- Remove trailing type from value attributes as emitc.opaque attributes are untyped. - Replace invalid trailing * in opaque type by wrapping it into an !emitc.ptr.
1 parent 5ac2260 commit 95f9b08

File tree

1 file changed

+4
-6
lines changed
  • mlir/include/mlir/Dialect/EmitC/IR

1 file changed

+4
-6
lines changed

mlir/include/mlir/Dialect/EmitC/IR/EmitC.td

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,8 @@ def EmitC_ConstantOp : EmitC_Op<"constant", [ConstantLike]> {
347347
%0 = "emitc.constant"(){value = 42 : i32} : () -> i32
348348

349349
// Constant emitted as `char = CHAR_MIN;`
350-
%1 = "emitc.constant"()
351-
{value = #emitc.opaque<"CHAR_MIN"> : !emitc.opaque<"char">}
352-
: () -> !emitc.opaque<"char">
350+
%1 = "emitc.constant"() {value = #emitc.opaque<"CHAR_MIN">}
351+
: () -> !emitc.opaque<"char">
353352
```
354353
}];
355354

@@ -992,9 +991,8 @@ def EmitC_VariableOp : EmitC_Op<"variable", []> {
992991
%0 = "emitc.variable"(){value = 42 : i32} : () -> i32
993992

994993
// Variable emitted as `int32_t* = NULL;`
995-
%1 = "emitc.variable"()
996-
{value = #emitc.opaque<"NULL"> : !emitc.opaque<"int32_t*">}
997-
: () -> !emitc.opaque<"int32_t*">
994+
%1 = "emitc.variable"() {value = #emitc.opaque<"NULL">}
995+
: () -> !emitc.ptr<!emitc.opaque<"int32_t">>
998996
```
999997

1000998
Since folding is not supported, it can be used with pointers.

0 commit comments

Comments
 (0)