Files
clang-p2996/mlir/lib/AsmParser/AttributeParser.cpp
lorenzo chelini 0181af2f32 [MLIR] Imporve location tracking for parseElementsLiteralType (#127992)
This commit improves line location tracking in case of error reporting
to the user in `parseElementsLiteralType`. There are two cases: the type
is already parsed [1] or not yet parsed [2]. With these changes we print
the error at the attribute's location in both cases to ensure
consistency.

Case 1)
```mlir
memref<i32> = dense<[3]>
              ^
```

Case 2)
```mlir
dense<[3]> : memref<i32>
^
```

Note that today for a simple:

```mlir
func.func @main() {
  %0 = arith.constant dense<[3]> : i32
  return
}
```

we print the error after the constant:

```
./bin/c.mlir:3:3: error: elements literal must be a shaped type
  return
  ^
```
2025-02-21 17:34:16 +01:00

42 KiB