[all-commits] [llvm/llvm-project] 0181af: [MLIR] Imporve location tracking for `parseElement...

lorenzo chelini via All-commits all-commits at lists.llvm.org
Fri Feb 21 08:34:38 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0181af2f32e51c2ac45d96bd194884d7adfd10ca
      https://github.com/llvm/llvm-project/commit/0181af2f32e51c2ac45d96bd194884d7adfd10ca
  Author: lorenzo chelini <l.chelini at icloud.com>
  Date:   2025-02-21 (Fri, 21 Feb 2025)

  Changed paths:
    M mlir/lib/AsmParser/AttributeParser.cpp
    M mlir/lib/AsmParser/Parser.h
    M mlir/test/IR/invalid-builtin-attributes.mlir

  Log Message:
  -----------
  [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
  ^
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list