r186795
On Sun, Jul 21, 2013 at 11:54 AM, Craig Topper <[email protected]>wrote: > Oops I wasn't thinking about it being static. D'oh! I'll put it back with > a comment this time. :) > > > On Sunday, July 21, 2013, Benjamin Kramer wrote: > >> >> On 19.07.2013, at 05:59, Craig Topper <[email protected]> wrote: >> >> > Author: ctopper >> > Date: Thu Jul 18 22:59:51 2013 >> > New Revision: 186649 >> > >> > URL: http://llvm.org/viewvc/llvm-project?rev=186649&view=rev >> > Log: >> > Remove unnecessary IsFirst variable from debug codde in GetDiagInfo. >> >> Was it really unnecessary? I think this was done to avoid a large hit in >> compile time in +Asserts builds. Now we verify the table on every lookup. >> Optimizing assertions may be not beneficial in general but in this case it >> doesn't add much code and doesn't affect the quality of the checks in any >> kind. Can you put it back? >> >> - Ben >> >> > >> > 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=186649&r1=186648&r2=186649&view=diff >> > >> ============================================================================== >> > --- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original) >> > +++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Thu Jul 18 22:59:51 2013 >> > @@ -94,17 +94,13 @@ static const unsigned StaticDiagInfoSize >> > static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { >> > // If assertions are enabled, verify that the StaticDiagInfo array is >> sorted. >> > #ifndef NDEBUG >> > - static bool IsFirst = true; >> > - 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"); >> > + 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; >> > + assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] && >> > + "Improperly sorted diag info"); >> > } >> > #endif >> > >> > >> > >> > _______________________________________________ >> > cfe-commits mailing list >> > [email protected] >> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >> >> > > -- > ~Craig > -- ~Craig
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
