#ifndef NDEBUG
static bool IsFirst = true; // So the check is only performed on first call.
if (IsFirst) {
- for (unsigned i = 1; i != StaticDiagInfoSize; ++i) {
- assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] &&
- "Diag ID conflict, the enums at the start of clang::diag (in "
- "DiagnosticIDs.h) probably need to be increased");
- }
+ assert(std::is_sorted(std::begin(StaticDiagInfo),
+ std::end(StaticDiagInfo)) &&
+ "Diag ID conflict, the enums at the start of clang::diag (in "
+ "DiagnosticIDs.h) probably need to be increased");
IsFirst = false;
}
#endif