diff options
| author | Craig Topper <craig.topper@gmail.com> | 2016-01-03 19:43:40 +0000 | 
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2016-01-03 19:43:40 +0000 | 
| commit | e30b8ca149076601ee593d93a35e39f7e7e219eb (patch) | |
| tree | a6273f17560d62d30d1871600620232b43cfbdb6 /llvm/lib/IR | |
| parent | 1f26d5b1e0a3ff4b1adfe5fc81acaecbc5e4a5c0 (diff) | |
| download | bcm5719-llvm-e30b8ca149076601ee593d93a35e39f7e7e219eb.tar.gz bcm5719-llvm-e30b8ca149076601ee593d93a35e39f7e7e219eb.zip | |
Use std::is_sorted and std::none_of instead of manual loops. NFC
llvm-svn: 256719
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/Attributes.cpp | 17 | 
1 files changed, 9 insertions, 8 deletions
| diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index bcf7dc365ce..6c01bb64562 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/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. | 

