[all-commits] [llvm/llvm-project] f3fce6: [MLIR][ODS] Error on optional attribute used outsi...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Mon Apr 13 04:23:26 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f3fce677f2a06e857433b42c5b5a38d554d79699
      https://github.com/llvm/llvm-project/commit/f3fce677f2a06e857433b42c5b5a38d554d79699
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2026-04-13 (Mon, 13 Apr 2026)

  Changed paths:
    M mlir/test/mlir-tblgen/op-format-invalid.td
    M mlir/test/mlir-tblgen/op-format-spec.td
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [MLIR][ODS] Error on optional attribute used outside optional group in assemblyFormat (#188726)

Using an optional attribute directly in assemblyFormat (e.g., `$attr
attr-dict`) without wrapping it in an optional group causes the
generated printer to call `printAttribute` with a null `Attribute` when
the attribute is absent. This leads to a crash in the alias initializer
when it calls `getAlias` on a null attribute.

Add a validation check in `OpFormatParser::verifyAttributes` that
detects this pattern and emits a diagnostic error with a helpful note
pointing users to the correct `($attr^)?` syntax.

Fixes #58064

Assisted-by: Claude Code



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