[mlir] NFC - Fix OperationSupport.cpp::findNamedAttr

Summary:
When NamedAttrList::get is called against a StringRef and the
entry is not present, the Identifier::operator== crashes.
Interestingly there seems to be no use of the NamedAttrList::get(StringRef) in
the codebase so far. A subsequent commit will introduce such a use.

Differential Revision: https://reviews.llvm.org/D80089
This commit is contained in:
Nicolas Vasilache 2020-05-18 09:33:35 -04:00
parent 57d8b8d6f0
commit 79f059c4ac
1 changed files with 1 additions and 1 deletions

View File

@ -97,7 +97,7 @@ static auto *findAttr(SmallVectorImpl<NamedAttribute> &attrs, T name,
}
auto *it = llvm::lower_bound(attrs, name);
if (it->first != name)
if (it == attrs.end() || it->first != name)
return attrs.end();
return it;
}