From: Douglas Gregor Date: Thu, 2 Dec 2010 00:22:25 +0000 (+0000) Subject: Eliminate two uses of NDEBUG in headers that cause different symbols X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a1c36c099df4dcc94d1d24516a8a2c809c764d4;p=clang Eliminate two uses of NDEBUG in headers that cause different symbols to be available in debug vs. release builds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120629 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 9d49c1e642..0aa60ce978 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -234,11 +234,7 @@ protected: unsigned IdentifierNamespace : 15; private: -#ifndef NDEBUG void CheckAccessDeclContext() const; -#else - void CheckAccessDeclContext() const { } -#endif protected: @@ -299,11 +295,15 @@ public: void setAccess(AccessSpecifier AS) { Access = AS; +#ifndef NDEBUG CheckAccessDeclContext(); +#endif } AccessSpecifier getAccess() const { +#ifndef NDEBUG CheckAccessDeclContext(); +#endif return AccessSpecifier(Access); } diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 0a7e755a9a..e52f6add1e 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -410,10 +410,6 @@ class CXXRecordDecl : public RecordDecl { llvm::PointerUnion TemplateOrInstantiation; -#ifndef NDEBUG - void CheckConversionFunction(NamedDecl *D); -#endif - friend class DeclContext; /// \brief Notify the class that member has been added. diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 7d8a92530e..843e907dea 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -424,8 +424,8 @@ SourceLocation Decl::getBodyRBrace() const { return SourceLocation(); } -#ifndef NDEBUG void Decl::CheckAccessDeclContext() const { +#ifndef NDEBUG // Suppress this check if any of the following hold: // 1. this is the translation unit (and thus has no parent) // 2. this is a template parameter (and thus doesn't belong to its context) @@ -449,9 +449,9 @@ void Decl::CheckAccessDeclContext() const { assert(Access != AS_none && "Access specifier is AS_none inside a record decl"); +#endif } -#endif //===----------------------------------------------------------------------===// // DeclContext Implementation diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp index 7679bf8244..547a70a7a5 100644 --- a/lib/AST/DeclCXX.cpp +++ b/lib/AST/DeclCXX.cpp @@ -726,20 +726,6 @@ const UnresolvedSetImpl *CXXRecordDecl::getVisibleConversionFunctions() { return &data().VisibleConversions; } -#ifndef NDEBUG -void CXXRecordDecl::CheckConversionFunction(NamedDecl *ConvDecl) { - assert(ConvDecl->getDeclContext() == this && - "conversion function does not belong to this record"); - - ConvDecl = ConvDecl->getUnderlyingDecl(); - if (FunctionTemplateDecl *Temp = dyn_cast(ConvDecl)) { - assert(isa(Temp->getTemplatedDecl())); - } else { - assert(isa(ConvDecl)); - } -} -#endif - void CXXRecordDecl::removeConversion(const NamedDecl *ConvDecl) { // This operation is O(N) but extremely rare. Sema only uses it to // remove UsingShadowDecls in a class that were followed by a direct