diff --git a/mlir/include/mlir/IR/SymbolInterfaces.td b/mlir/include/mlir/IR/SymbolInterfaces.td --- a/mlir/include/mlir/IR/SymbolInterfaces.td +++ b/mlir/include/mlir/IR/SymbolInterfaces.td @@ -58,6 +58,24 @@ mlir::SymbolTable::setSymbolVisibility(this->getOperation(), vis); }] >, + InterfaceMethod<"Returns true if this symbol has nested visibility", + "bool", "isNested", (ins), [{}], + /*defaultImplementation=*/[{ + return getVisibility() == mlir::SymbolTable::Visibility::Nested; + }] + >, + InterfaceMethod<"Returns true if this symbol has private visibility", + "bool", "isPrivate", (ins), [{}], + /*defaultImplementation=*/[{ + return getVisibility() == mlir::SymbolTable::Visibility::Private; + }] + >, + InterfaceMethod<"Returns true if this symbol has public visibility", + "bool", "isPublic", (ins), [{}], + /*defaultImplementation=*/[{ + return getVisibility() == mlir::SymbolTable::Visibility::Public; + }] + >, InterfaceMethod<[{ Get all of the uses of the current symbol that are nested within the given operation 'from'. @@ -124,20 +142,11 @@ }]; let extraClassDeclaration = [{ - using Visibility = mlir::SymbolTable::Visibility; - /// Custom classof that handles the case where the symbol is optional. static bool classof(Operation *op) { return Base::classof(op) && op->getAttr(::mlir::SymbolTable::getSymbolAttrName()); } - - /// Returns true if this symbol has nested visibility. - bool isNested() { return getVisibility() == Visibility::Nested; } - /// Returns true if this symbol has private visibility. - bool isPrivate() { return getVisibility() == Visibility::Private; } - /// Returns true if this symbol has public visibility. - bool isPublic() { return getVisibility() == Visibility::Public; } }]; let extraTraitClassDeclaration = [{