diff options
-rw-r--r-- | clang/include/clang/Sema/Lookup.h | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/include/clang/Sema/Lookup.h b/clang/include/clang/Sema/Lookup.h index 1c24d20ee83..e7a6f15c0e7 100644 --- a/clang/include/clang/Sema/Lookup.h +++ b/clang/include/clang/Sema/Lookup.h @@ -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) diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index b8901e20637..40774e135c9 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -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 || |