summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/IR/Attributes.cpp')
-rw-r--r--contrib/llvm/lib/IR/Attributes.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/contrib/llvm/lib/IR/Attributes.cpp b/contrib/llvm/lib/IR/Attributes.cpp
index bcf7dc3..6c01bb6 100644
--- a/contrib/llvm/lib/IR/Attributes.cpp
+++ b/contrib/llvm/lib/IR/Attributes.cpp
@@ -641,14 +641,15 @@ AttributeSet AttributeSet::get(LLVMContext &C,
if (Attrs.empty())
return AttributeSet();
-#ifndef NDEBUG
- for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
- assert((!i || Attrs[i-1].first <= Attrs[i].first) &&
- "Misordered Attributes list!");
- assert(!Attrs[i].second.hasAttribute(Attribute::None) &&
- "Pointless attribute!");
- }
-#endif
+ assert(std::is_sorted(Attrs.begin(), Attrs.end(),
+ [](const std::pair<unsigned, Attribute> &LHS,
+ const std::pair<unsigned, Attribute> &RHS) {
+ return LHS.first < RHS.first;
+ }) && "Misordered Attributes list!");
+ assert(std::none_of(Attrs.begin(), Attrs.end(),
+ [](const std::pair<unsigned, Attribute> &Pair) {
+ return Pair.second.hasAttribute(Attribute::None);
+ }) && "Pointless attribute!");
// Create a vector if (unsigned, AttributeSetNode*) pairs from the attributes
// list.
OpenPOWER on IntegriCloud