From 76503c750e8a5a97e62a0b055934206ec142de01 Mon Sep 17 00:00:00 2001 From: Richard Barton Date: Fri, 16 Oct 2015 20:15:29 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250546 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/DiagnosticIDs.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index 643503b00b..b855ac2e32 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -101,12 +101,9 @@ static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { 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; } -- 2.40.0