diff options
author | Craig Topper <craig.topper@gmail.com> | 2015-10-18 05:29:21 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2015-10-18 05:29:21 +0000 |
commit | 2685cbe0566ffd9babc40746b9f2d18e6c12800d (patch) | |
tree | a4bb384811ece1cbca68f09d747614bc6f1adc57 | |
parent | 92cfdd70f812acb0276a9eb7afe492770dbc5f08 (diff) | |
download | bcm5719-llvm-2685cbe0566ffd9babc40746b9f2d18e6c12800d.tar.gz bcm5719-llvm-2685cbe0566ffd9babc40746b9f2d18e6c12800d.zip |
Use std::is_sorted instead of a manual loop.
llvm-svn: 250645
-rw-r--r-- | clang/lib/Basic/DiagnosticIDs.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp index fd8334281d0..61da8e3cb0f 100644 --- a/clang/lib/Basic/DiagnosticIDs.cpp +++ b/clang/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 |