diff options
author | Craig Topper <craig.topper@gmail.com> | 2013-07-21 18:58:40 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2013-07-21 18:58:40 +0000 |
commit | 31e71a3997128c8c670a6e158bc3c2f22765f2e9 (patch) | |
tree | 6a0f6c9557eb5f665f9c3c16a8a5710c3843f42b | |
parent | f2d2e8ff02bd178e91492dd3db8838a0031ddf45 (diff) | |
download | bcm5719-llvm-31e71a3997128c8c670a6e158bc3c2f22765f2e9.tar.gz bcm5719-llvm-31e71a3997128c8c670a6e158bc3c2f22765f2e9.zip |
Revert r186649 because it wasn't unnecessary and add a comment.
llvm-svn: 186795
-rw-r--r-- | clang/lib/Basic/DiagnosticIDs.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp index e96d5097e62..898c51c4970 100644 --- a/clang/lib/Basic/DiagnosticIDs.cpp +++ b/clang/lib/Basic/DiagnosticIDs.cpp @@ -92,13 +92,17 @@ static const unsigned StaticDiagInfoSize = llvm::array_lengthof(StaticDiagInfo); static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { // If assertions are enabled, verify that the StaticDiagInfo array is sorted. #ifndef NDEBUG - for (unsigned i = 1; i != StaticDiagInfoSize; ++i) { - assert(StaticDiagInfo[i-1].DiagID != StaticDiagInfo[i].DiagID && - "Diag ID conflict, the enums at the start of clang::diag (in " - "DiagnosticIDs.h) probably need to be increased"); - - assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] && - "Improperly sorted diag info"); + 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].DiagID != StaticDiagInfo[i].DiagID && + "Diag ID conflict, the enums at the start of clang::diag (in " + "DiagnosticIDs.h) probably need to be increased"); + + assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] && + "Improperly sorted diag info"); + } + IsFirst = false; } #endif |