]> granicus.if.org Git - clang/commitdiff
increase helpfulness of assert message.
authorChris Lattner <sabre@nondot.org>
Fri, 16 Oct 2009 02:34:51 +0000 (02:34 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 16 Oct 2009 02:34:51 +0000 (02:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84240 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Diagnostic.cpp

index 4a29997a2ccc376d7912ccd8ab7ca43f7a92fd25..7ae7c76bb5c9b5118c51c6d19cc8902d13d87c82 100644 (file)
@@ -82,9 +82,14 @@ static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) {
 #ifndef NDEBUG
   static bool IsFirst = true;
   if (IsFirst) {
-    for (unsigned i = 1; i != NumDiagEntries; ++i)
+    for (unsigned i = 1; i != NumDiagEntries; ++i) {
+      assert(StaticDiagInfo[i-1].DiagID != StaticDiagInfo[i].DiagID &&
+             "Diag ID conflict, the enums at the start of clang::diag (in "
+             "Diagnostic.h) probably need to be increased");
+
       assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] &&
              "Improperly sorted diag info");
+    }
     IsFirst = false;
   }
 #endif