DeclContext *Parent, std::size_t Extra = 0);
private:
- void CheckAccessDeclContext() const;
+ bool AccessDeclContextSanity() const;
protected:
void setAccess(AccessSpecifier AS) {
Access = AS;
-#ifndef NDEBUG
- CheckAccessDeclContext();
-#endif
+ assert(AccessDeclContextSanity());
}
AccessSpecifier getAccess() const {
-#ifndef NDEBUG
- CheckAccessDeclContext();
-#endif
+ assert(AccessDeclContextSanity());
return AccessSpecifier(Access);
}
private:
Stmt *Op;
- void CheckCastConsistency() const;
+ bool CastConsistency() const;
const CXXBaseSpecifier * const *path_buffer() const {
return const_cast<CastExpr*>(this)->path_buffer();
assert(kind != CK_Invalid && "creating cast with invalid cast kind");
CastExprBits.Kind = kind;
setBasePathSize(BasePathSize);
-#ifndef NDEBUG
- CheckCastConsistency();
-#endif
+ assert(CastConsistency());
}
/// \brief Construct an empty cast.
}
LookupResultKind getResultKind() const {
- sanity();
+ assert(sanity());
return ResultKind;
}
void configure();
// Sanity checks.
- void sanityImpl() const;
-
- void sanity() const {
-#ifndef NDEBUG
- sanityImpl();
-#endif
- }
+ bool sanity() const;
bool sanityCheckUnresolved() const {
for (iterator I = begin(), E = end(); I != E; ++I)
return SourceLocation();
}
-void Decl::CheckAccessDeclContext() const {
+bool Decl::AccessDeclContextSanity() const {
#ifndef NDEBUG
// Suppress this check if any of the following hold:
// 1. this is the translation unit (and thus has no parent)
// AS_none as access specifier.
isa<CXXRecordDecl>(this) ||
isa<ClassScopeFunctionSpecializationDecl>(this))
- return;
+ return true;
assert(Access != AS_none &&
"Access specifier is AS_none inside a record decl");
#endif
+ return true;
}
static Decl::Kind getKind(const Decl *D) { return D->getKind(); }
return EndLoc;
}
-void CastExpr::CheckCastConsistency() const {
+bool CastExpr::CastConsistency() const {
switch (getCastKind()) {
case CK_DerivedToBase:
case CK_UncheckedDerivedToBase:
assert(path_empty() && "Cast kind should not have a base path!");
break;
}
+ return true;
}
const char *CastExpr::getCastKindName() const {
}
}
-void LookupResult::sanityImpl() const {
+bool LookupResult::sanity() const {
// Note that this function is never called by NDEBUG builds. See
// LookupResult::sanity().
assert(ResultKind != NotFound || Decls.size() == 0);
assert((Paths != NULL) == (ResultKind == Ambiguous &&
(Ambiguity == AmbiguousBaseSubobjectTypes ||
Ambiguity == AmbiguousBaseSubobjects)));
+ return true;
}
// Necessary because CXXBasePaths is not complete in Sema.h