Sema: Don't emit a gajillion calls to sanity() -- an empty function -- in NDEBUG

builds. Sheesh.

llvm-svn: 152279
This commit is contained in:
Daniel Dunbar 2012-03-08 01:43:06 +00:00
parent 02a80da331
commit 9e19f13416
2 changed files with 10 additions and 2 deletions

View 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)

View 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 ||