]> granicus.if.org Git - clang/commitdiff
Sema: Don't emit a gajillion calls to sanity() -- an empty function -- in NDEBUG
authorDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 01:43:06 +0000 (01:43 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 8 Mar 2012 01:43:06 +0000 (01:43 +0000)
builds. Sheesh.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152279 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/Lookup.h
lib/Sema/SemaLookup.cpp

index 1c24d20ee835ceb79429a792d9cd26604006cbaa..e7a6f15c0e7d1a3f32d473a23f16af41f17f2373 100644 (file)
@@ -600,7 +600,13 @@ private:
   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)
index b8901e2063791c62273f76042acdb9fc072f0f73..40774e135c9a15023af18726794135517972d5da 100644 (file)
@@ -302,7 +302,9 @@ void LookupResult::configure() {
   }
 }
 
-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 ||