<br><br><div class="gmail_quote">Le 8 mars 2012 02:43, 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">
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 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: <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>
--- 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: <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>
--- 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></blockquote><div>Since sanityImpl is only ever useful in NDEBUG builds, it could be useful to #ifdef both its declaration and definition with NDEBUG, would not it ?<br><br>-- Matthieu<br> </div></div>