]> granicus.if.org Git - clang/commitdiff
Use std::is_sorted instead of a manual loop.
authorCraig Topper <craig.topper@gmail.com>
Sun, 18 Oct 2015 05:29:21 +0000 (05:29 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 18 Oct 2015 05:29:21 +0000 (05:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250645 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/DiagnosticIDs.cpp

index fd8334281d0b01edf31c0884c0bcc4e852273212..61da8e3cb0f2559ec9dfda452f31e1ba658f7850 100644 (file)
@@ -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