[cfe-commits] r120629 - in /cfe/trunk: include/clang/AST/DeclBase.h include/clang/AST/DeclCXX.h lib/AST/DeclBase.cpp lib/AST/DeclCXX.cpp

Douglas Gregor dgregor at apple.com
Wed Dec 1 16:22:25 PST 2010


Author: dgregor
Date: Wed Dec  1 18:22:25 2010
New Revision: 120629

URL: http://llvm.org/viewvc/llvm-project?rev=120629&view=rev
Log:
Eliminate two uses of NDEBUG in headers that cause different symbols
to be available in debug vs. release builds.

Modified:
    cfe/trunk/include/clang/AST/DeclBase.h
    cfe/trunk/include/clang/AST/DeclCXX.h
    cfe/trunk/lib/AST/DeclBase.cpp
    cfe/trunk/lib/AST/DeclCXX.cpp

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=120629&r1=120628&r2=120629&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Wed Dec  1 18:22:25 2010
@@ -234,11 +234,7 @@
   unsigned IdentifierNamespace : 15;
 
 private:
-#ifndef NDEBUG
   void CheckAccessDeclContext() const;
-#else
-  void CheckAccessDeclContext() const { }
-#endif
 
 protected:
 
@@ -299,11 +295,15 @@
 
   void setAccess(AccessSpecifier AS) {
     Access = AS;
+#ifndef NDEBUG
     CheckAccessDeclContext();
+#endif
   }
 
   AccessSpecifier getAccess() const {
+#ifndef NDEBUG
     CheckAccessDeclContext();
+#endif
     return AccessSpecifier(Access);
   }
 

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=120629&r1=120628&r2=120629&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Wed Dec  1 18:22:25 2010
@@ -410,10 +410,6 @@
   llvm::PointerUnion<ClassTemplateDecl*, MemberSpecializationInfo*>
     TemplateOrInstantiation;
 
-#ifndef NDEBUG
-  void CheckConversionFunction(NamedDecl *D);
-#endif
-  
   friend class DeclContext;
   
   /// \brief Notify the class that member has been added.

Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=120629&r1=120628&r2=120629&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Wed Dec  1 18:22:25 2010
@@ -424,8 +424,8 @@
   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 @@
 
   assert(Access != AS_none &&
          "Access specifier is AS_none inside a record decl");
+#endif
 }
 
-#endif
 
 //===----------------------------------------------------------------------===//
 // DeclContext Implementation

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=120629&r1=120628&r2=120629&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Wed Dec  1 18:22:25 2010
@@ -726,20 +726,6 @@
   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





More information about the cfe-commits mailing list