[all-commits] [llvm/llvm-project] eea1e5: [mlir-tblgen] trim method body to empty with only ...

drazi via All-commits all-commits at lists.llvm.org
Tue May 13 01:03:29 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: eea1e50ac281d667992aa74c1819cd80b8eb634f
      https://github.com/llvm/llvm-project/commit/eea1e50ac281d667992aa74c1819cd80b8eb634f
  Author: drazi <fengxie83 at gmail.com>
  Date:   2025-05-13 (Tue, 13 May 2025)

  Changed paths:
    M mlir/lib/TableGen/Interfaces.cpp
    A mlir/test/mlir-tblgen/method-body-with-only-spaces.td

  Log Message:
  -----------
  [mlir-tblgen] trim method body to empty with only spaces to avoid crash (#139568)

method body or default impl must be true empty. Even they contain only
spaces, ``mlir-tblgen`` considers they are non-empty and generates
invalid code lead to segment fault. It's very hard to debug.

```c++
    InterfaceMethod<
      ...
      /*methodBody=*/  [{ }],    // This must be true empty. Leaving a space here can lead to segment fault which is hard to figure out why
      /*defaultImpl=*/ [{
        ...
      }]
```

This PR trim spaces when method body or default implementation of
interface method is not empty. Now ``mlir-tblgen`` generates valid code
even when they contain only spaces.

---------

Co-authored-by: Fung Xie <ftse at nvidia.com>
Co-authored-by: Mehdi Amini <joker.eph at gmail.com>



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