forked from OSchip/llvm-project
Use std::is_sorted instead of manual loops. NFC
llvm-svn: 256701
This commit is contained in:
parent
1097df3b4a
commit
5f167729aa
|
@ -59,6 +59,11 @@ struct SubtargetFeatureKV {
|
|||
bool operator<(StringRef S) const {
|
||||
return StringRef(Key) < S;
|
||||
}
|
||||
|
||||
// Compare routine for std::is_sorted.
|
||||
bool operator<(const SubtargetFeatureKV &Other) const {
|
||||
return StringRef(Key) < StringRef(Other.Key);
|
||||
}
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -234,14 +234,10 @@ SubtargetFeatures::getFeatureBits(StringRef CPU,
|
|||
return FeatureBitset();
|
||||
|
||||
#ifndef NDEBUG
|
||||
for (size_t i = 1, e = CPUTable.size(); i != e; ++i) {
|
||||
assert(strcmp(CPUTable[i - 1].Key, CPUTable[i].Key) < 0 &&
|
||||
"CPU table is not sorted");
|
||||
}
|
||||
for (size_t i = 1, e = FeatureTable.size(); i != e; ++i) {
|
||||
assert(strcmp(FeatureTable[i - 1].Key, FeatureTable[i].Key) < 0 &&
|
||||
"CPU features table is not sorted");
|
||||
}
|
||||
assert(std::is_sorted(std::begin(CPUTable), std::end(CPUTable)) &&
|
||||
"CPU table is not sorted");
|
||||
assert(std::is_sorted(std::begin(FeatureTable), std::end(FeatureTable)) &&
|
||||
"CPU features table is not sorted");
|
||||
#endif
|
||||
// Resulting bits
|
||||
FeatureBitset Bits;
|
||||
|
|
Loading…
Reference in New Issue