[Mlir-commits] [mlir] [mlir][Symbol] Add verification that symbol's parent is a SymbolTable (PR #80590)

Mehdi Amini llvmlistbot at llvm.org
Sun Feb 4 11:21:44 PST 2024


================
@@ -171,6 +171,11 @@ def Symbol : OpInterface<"SymbolOpInterface"> {
     if (concreteOp.isDeclaration() && concreteOp.isPublic())
       return concreteOp.emitOpError("symbol declaration cannot have public "
              "visibility");
+    auto parent = $_op->getParentOp();
+    if (parent && !parent->hasTrait<OpTrait::SymbolTable>()) {
----------------
joker-eph wrote:

```suggestion
    if (parent && !parent->hasTrait<OpTrait::SymbolTable>() && parent->isRegistered()) {
```

(We don't know if an unregistered operation implements the symbol table or not)


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


More information about the Mlir-commits mailing list