From: Craig Topper Date: Sun, 18 Oct 2015 05:29:21 +0000 (+0000) Subject: Use std::is_sorted instead of a manual loop. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75e87a3c9c7f2527ac932f4c5da7d082b8cb646e;p=clang Use std::is_sorted instead of a manual loop. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250645 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index fd8334281d..61da8e3cb0 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -100,11 +100,10 @@ static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { #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