/// Return the underlying dictionary attribute.
DictionaryAttr getDictionary(MLIRContext *context) const;
+ /// Return the underlying dictionary attribute or null if there are no
+ /// attributes within this dictionary.
+ DictionaryAttr getDictionaryOrNull() const { return attrs; }
+
/// Return all of the attributes on this operation.
ArrayRef<NamedAttribute> getAttrs() const;
/// Return true if the given operation is unknown and may potentially define a
/// symbol table.
static bool isPotentiallyUnknownSymbolTable(Operation *op) {
- return !op->getDialect() && op->getNumRegions() == 1;
+ return op->getNumRegions() == 1 && !op->getDialect();
}
/// Returns the string name of the given symbol, or None if this is not a
Operation *op,
function_ref<WalkResult(SymbolTable::SymbolUse, ArrayRef<int>)> callback) {
// Check to see if the operation has any attributes.
- if (op->getMutableAttrDict().empty())
+ DictionaryAttr attrDict = op->getMutableAttrDict().getDictionaryOrNull();
+ if (!attrDict)
return WalkResult::advance();
- DictionaryAttr attrDict = op->getAttrDictionary();
// A worklist of a container attribute and the current index into the held
// attribute list.