<div dir="ltr">r186795</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 21, 2013 at 11:54 AM, Craig Topper <span dir="ltr"><<a href="mailto:craig.topper@gmail.com" target="_blank">craig.topper@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Oops I wasn't thinking about it being static. D'oh! I'll put it back with a comment this time. :)<div class="HOEnZb">
<div class="h5"><span></span><br><br>On Sunday, July 21, 2013, Benjamin Kramer  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On 19.07.2013, at 05:59, Craig Topper <<a>craig.topper@gmail.com</a>> wrote:<br>
<br>
> Author: ctopper<br>
> Date: Thu Jul 18 22:59:51 2013<br>
> New Revision: 186649<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=186649&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=186649&view=rev</a><br>
> Log:<br>
> Remove unnecessary IsFirst variable from debug codde in GetDiagInfo.<br>
<br>
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?<br>


<br>
- Ben<br>
<br>
><br>
> Modified:<br>
>    cfe/trunk/lib/Basic/DiagnosticIDs.cpp<br>
><br>
> Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=186649&r1=186648&r2=186649&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=186649&r1=186648&r2=186649&view=diff</a><br>


> ==============================================================================<br>
> --- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)<br>
> +++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Thu Jul 18 22:59:51 2013<br>
> @@ -94,17 +94,13 @@ static const unsigned StaticDiagInfoSize<br>
> static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) {<br>
>   // If assertions are enabled, verify that the StaticDiagInfo array is sorted.<br>
> #ifndef NDEBUG<br>
> -  static bool IsFirst = true;<br>
> -  if (IsFirst) {<br>
> -    for (unsigned i = 1; i != StaticDiagInfoSize; ++i) {<br>
> -      assert(StaticDiagInfo[i-1].DiagID != StaticDiagInfo[i].DiagID &&<br>
> -             "Diag ID conflict, the enums at the start of clang::diag (in "<br>
> -             "DiagnosticIDs.h) probably need to be increased");<br>
> +  for (unsigned i = 1; i != StaticDiagInfoSize; ++i) {<br>
> +    assert(StaticDiagInfo[i-1].DiagID != StaticDiagInfo[i].DiagID &&<br>
> +           "Diag ID conflict, the enums at the start of clang::diag (in "<br>
> +           "DiagnosticIDs.h) probably need to be increased");<br>
><br>
> -      assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] &&<br>
> -             "Improperly sorted diag info");<br>
> -    }<br>
> -    IsFirst = false;<br>
> +    assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] &&<br>
> +           "Improperly sorted diag info");<br>
>   }<br>
> #endif<br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a>cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br>
</blockquote><br><br></div></div><span class="HOEnZb"><font color="#888888">-- <br>~Craig<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>~Craig
</div>