[Mlir-commits] [mlir] [mlir-tblgen] trim method body to empty with only spaces to avoid crash (PR #139568)

Mehdi Amini llvmlistbot at llvm.org
Mon May 12 09:02:43 PDT 2025


================
@@ -47,12 +47,18 @@ bool InterfaceMethod::isStatic() const {
 // Return the body for this method if it has one.
 std::optional<StringRef> InterfaceMethod::getBody() const {
   auto value = def->getValueAsString("body");
+  // Trim leading and trailing spaces from the default implementation.
+  if (!value.empty())
+    value = value.trim();
----------------
joker-eph wrote:

```suggestion
  // Trim leading and trailing spaces from the default implementation.
  auto value = def->getValueAsString("body").trim();
```
Do you need to the `if` here?

https://github.com/llvm/llvm-project/pull/139568


More information about the Mlir-commits mailing list