]> granicus.if.org Git - clang/commitdiff
Eliminate two uses of NDEBUG in headers that cause different symbols
authorDouglas Gregor <dgregor@apple.com>
Thu, 2 Dec 2010 00:22:25 +0000 (00:22 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 2 Dec 2010 00:22:25 +0000 (00:22 +0000)
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

include/clang/AST/DeclBase.h
include/clang/AST/DeclCXX.h
lib/AST/DeclBase.cpp
lib/AST/DeclCXX.cpp

index 9d49c1e642cdfec7ff8d5b17ec89b692da1d403b..0aa60ce9782edafd214c56a72276d16b77179f6b 100644 (file)
@@ -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);
   }
 
index 0a7e755a9aac2c42d2d002dc32e4979d3c3db742..e52f6add1edc370158084b52402ff740b0c3df02 100644 (file)
@@ -410,10 +410,6 @@ class CXXRecordDecl : public RecordDecl {
   llvm::PointerUnion<ClassTemplateDecl*, MemberSpecializationInfo*>
     TemplateOrInstantiation;
 
-#ifndef NDEBUG
-  void CheckConversionFunction(NamedDecl *D);
-#endif
-  
   friend class DeclContext;
   
   /// \brief Notify the class that member has been added.
index 7d8a92530e072603ca4b76011c5dc387603d3b6a..843e907dea9aad1ea6fc0cb2b495c4dc0f2adcc0 100644 (file)
@@ -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
index 7679bf82441048d9a9efd9131c866082854d76f3..547a70a7a58f761053cf961b7d7f57e158b35717 100644 (file)
@@ -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<FunctionTemplateDecl>(ConvDecl)) {
-    assert(isa<CXXConversionDecl>(Temp->getTemplatedDecl()));
-  } else {
-    assert(isa<CXXConversionDecl>(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