<br><br><div class="gmail_quote">Le 8 mars 2012 20:14, Daniel Dunbar <span dir="ltr"><<a href="mailto:daniel@zuster.org">daniel@zuster.org</a>></span> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Mar 8, 2012 at 11:08 AM, Matthieu Monrocq<br>
<<a href="mailto:matthieu.monrocq@gmail.com">matthieu.monrocq@gmail.com</a>> wrote:<br>
><br>
><br>
> Le 8 mars 2012 02:43, Daniel Dunbar <<a href="mailto:daniel@zuster.org">daniel@zuster.org</a>> a écrit :<br>
><br>
>> Author: ddunbar<br>
>> Date: Wed Mar 7 19:43:06 2012<br>
>> New Revision: 152279<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=152279&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=152279&view=rev</a><br>
>> Log:<br>
>> Sema: Don't emit a gajillion calls to sanity() -- an empty function -- in<br>
>> NDEBUG<br>
>> builds. Sheesh.<br>
>><br>
>> Modified:<br>
>> cfe/trunk/include/clang/Sema/Lookup.h<br>
>> cfe/trunk/lib/Sema/SemaLookup.cpp<br>
>><br>
>> Modified: cfe/trunk/include/clang/Sema/Lookup.h<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=152279&r1=152278&r2=152279&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=152279&r1=152278&r2=152279&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/include/clang/Sema/Lookup.h (original)<br>
>> +++ cfe/trunk/include/clang/Sema/Lookup.h Wed Mar 7 19:43:06 2012<br>
>> @@ -600,7 +600,13 @@<br>
>> void configure();<br>
>><br>
>> // Sanity checks.<br>
>> - void sanity() const;<br>
>> + void sanityImpl() const;<br>
>> +<br>
>> + void sanity() const {<br>
>> +#ifndef NDEBUG<br>
>> + sanityImpl();<br>
>> +#endif<br>
>> + }<br>
>><br>
>> bool sanityCheckUnresolved() const {<br>
>> for (iterator I = begin(), E = end(); I != E; ++I)<br>
>><br>
>> Modified: cfe/trunk/lib/Sema/SemaLookup.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=152279&r1=152278&r2=152279&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=152279&r1=152278&r2=152279&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/Sema/SemaLookup.cpp (original)<br>
>> +++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Mar 7 19:43:06 2012<br>
>> @@ -302,7 +302,9 @@<br>
>> }<br>
>> }<br>
>><br>
>> -void LookupResult::sanity() const {<br>
>> +void LookupResult::sanityImpl() const {<br>
>> + // Note that this function is never called by NDEBUG builds. See<br>
>> + // LookupResult::sanity().<br>
>> assert(ResultKind != NotFound || Decls.size() == 0);<br>
>> assert(ResultKind != Found || Decls.size() == 1);<br>
>> assert(ResultKind != FoundOverloaded || Decls.size() > 1 ||<br>
>><br>
>><br>
> Since sanityImpl is only ever useful in NDEBUG builds, it could be useful to<br>
> #ifdef both its declaration and definition with NDEBUG, would not it ?<br>
<br>
I don't like changing the external API based on NDEBUG or not.<br>
<br>
- Daniel<br>
<br>
> -- Matthieu<br>
><br>
</blockquote></div><br>Isn't it a private function though ?<br><br>Anyway, not that *I* mind :)<br><br>-- Matthieu<br>