r186649 - Remove unnecessary IsFirst variable from debug codde in GetDiagInfo.
Craig Topper
craig.topper at gmail.com
Sun Jul 21 12:00:37 PDT 2013
r186795
On Sun, Jul 21, 2013 at 11:54 AM, Craig Topper <craig.topper at gmail.com>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 <craig.topper at gmail.com> 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
>> > cfe-commits at cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
>
> --
> ~Craig
>
--
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130721/245d9b1c/attachment.html>
More information about the cfe-commits
mailing list