From cb4e68c34032d5de2983e3ae6bebfbb25875dd23 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 16 Oct 2009 02:34:51 +0000 Subject: increase helpfulness of assert message. llvm-svn: 84240 --- clang/lib/Basic/Diagnostic.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'clang/lib/Basic') diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index 4a29997a2cc..7ae7c76bb5c 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/lib/Basic/Diagnostic.cpp @@ -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 -- cgit v1.2.3