[PATCH] D80089: [mlir] NFC - Fix OperationSupport.cpp::findNamedAttr
Nicolas Vasilache via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 17 12:47:20 PDT 2020
nicolasvasilache created this revision.
nicolasvasilache added reviewers: mehdi_amini, rriddle, ftynse.
Herald added subscribers: llvm-commits, jurahul, Kayjukh, frgossen, grosul1, Joonsoo, stephenneuendorffer, liufengdb, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, jpienaar.
Herald added 1 blocking reviewer(s): rriddle.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80089
Files:
mlir/lib/IR/OperationSupport.cpp
Index: mlir/lib/IR/OperationSupport.cpp
===================================================================
--- mlir/lib/IR/OperationSupport.cpp
+++ mlir/lib/IR/OperationSupport.cpp
@@ -97,7 +97,7 @@
}
auto *it = llvm::lower_bound(attrs, name);
- if (it->first != name)
+ if (it == attrs.end() || it->first != name)
return attrs.end();
return it;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80089.264507.patch
Type: text/x-patch
Size: 368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200517/75ba8865/attachment.bin>
More information about the llvm-commits
mailing list