r250546 - Further increase helfulness of assert message

Richard Barton via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 16 13:15:29 PDT 2015


Author: rbarton
Date: Fri Oct 16 15:15:29 2015
New Revision: 250546

URL: http://llvm.org/viewvc/llvm-project?rev=250546&view=rev
Log:
Further increase helfulness of assert message

If you increase the number of diags of a particular type by one more than the
number available you get the nice assert message. If you do it by two more
than available you get the old non-helpful message. Combining the two makes
sense I think.

Modified:
    cfe/trunk/lib/Basic/DiagnosticIDs.cpp

Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=250546&r1=250545&r2=250546&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
+++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Fri Oct 16 15:15:29 2015
@@ -101,12 +101,9 @@ static const StaticDiagInfoRec *GetDiagI
   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 &&
+      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(StaticDiagInfo[i-1] < StaticDiagInfo[i] &&
-             "Improperly sorted diag info");
     }
     IsFirst = false;
   }




More information about the cfe-commits mailing list