[cfe-commits] r152279 - in /cfe/trunk: include/clang/Sema/Lookup.h lib/Sema/SemaLookup.cpp

Daniel Dunbar daniel at zuster.org
Wed Mar 7 17:43:06 PST 2012


Author: ddunbar
Date: Wed Mar  7 19:43:06 2012
New Revision: 152279

URL: http://llvm.org/viewvc/llvm-project?rev=152279&view=rev
Log:
Sema: Don't emit a gajillion calls to sanity() -- an empty function -- in NDEBUG
builds. Sheesh.

Modified:
    cfe/trunk/include/clang/Sema/Lookup.h
    cfe/trunk/lib/Sema/SemaLookup.cpp

Modified: cfe/trunk/include/clang/Sema/Lookup.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=152279&r1=152278&r2=152279&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Lookup.h (original)
+++ cfe/trunk/include/clang/Sema/Lookup.h Wed Mar  7 19:43:06 2012
@@ -600,7 +600,13 @@
   void configure();
 
   // Sanity checks.
-  void sanity() const;
+  void sanityImpl() const;
+
+  void sanity() const {
+#ifndef NDEBUG
+    sanityImpl();
+#endif
+  }
 
   bool sanityCheckUnresolved() const {
     for (iterator I = begin(), E = end(); I != E; ++I)

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=152279&r1=152278&r2=152279&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Mar  7 19:43:06 2012
@@ -302,7 +302,9 @@
   }
 }
 
-void LookupResult::sanity() const {
+void LookupResult::sanityImpl() const {
+  // Note that this function is never called by NDEBUG builds. See
+  // LookupResult::sanity().
   assert(ResultKind != NotFound || Decls.size() == 0);
   assert(ResultKind != Found || Decls.size() == 1);
   assert(ResultKind != FoundOverloaded || Decls.size() > 1 ||





More information about the cfe-commits mailing list