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

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Sep 8 14:32:35 PDT 2010


Author: akirtzidis
Date: Wed Sep  8 16:32:35 2010
New Revision: 113413

URL: http://llvm.org/viewvc/llvm-project?rev=113413&view=rev
Log:
Re-enable CheckAccessDeclContext and make sure it doesn't trigger assertions.

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

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=113413&r1=113412&r2=113413&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Wed Sep  8 16:32:35 2010
@@ -112,6 +112,8 @@
     : Decl(AccessSpec, DC, ASLoc), ColonLoc(ColonLoc) {
     setAccess(AS);
   }
+  AccessSpecDecl(EmptyShell Empty)
+    : Decl(AccessSpec, Empty) { }
 public:
   /// getAccessSpecifierLoc - The location of the access specifier.
   SourceLocation getAccessSpecifierLoc() const { return getLocation(); }
@@ -132,6 +134,9 @@
                                 SourceLocation ColonLoc) {
     return new (C) AccessSpecDecl(AS, DC, ASLoc, ColonLoc);
   }
+  static AccessSpecDecl *Create(ASTContext &C, EmptyShell Empty) {
+    return new (C) AccessSpecDecl(Empty);
+  }
 
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }

Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=113413&r1=113412&r2=113413&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Wed Sep  8 16:32:35 2010
@@ -418,18 +418,20 @@
 
 #ifndef NDEBUG
 void Decl::CheckAccessDeclContext() const {
-  // FIXME: Disable this until rdar://8146294 "access specifier for inner class
-  // templates is not set or checked" is fixed.
-  return;
   // 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)
   // 3. the context is not a record
   // 4. it's invalid
+  // 5. it's a C++0x static_assert.
   if (isa<TranslationUnitDecl>(this) ||
       isa<TemplateTypeParmDecl>(this) ||
       !isa<CXXRecordDecl>(getDeclContext()) ||
-      isInvalidDecl())
+      isInvalidDecl() ||
+      isa<StaticAssertDecl>(this) ||
+      // FIXME: a ParmVarDecl can have ClassTemplateSpecialization
+      // as DeclContext (?).
+      isa<ParmVarDecl>(this))
     return;
 
   assert(Access != AS_none &&

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=113413&r1=113412&r2=113413&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Wed Sep  8 16:32:35 2010
@@ -1308,8 +1308,7 @@
     D = CXXConversionDecl::Create(*Context, Decl::EmptyShell());
     break;
   case DECL_ACCESS_SPEC:
-    D = AccessSpecDecl::Create(*Context, AS_none, 0, SourceLocation(),
-                               SourceLocation());
+    D = AccessSpecDecl::Create(*Context, Decl::EmptyShell());
     break;
   case DECL_FRIEND:
     D = FriendDecl::Create(*Context, Decl::EmptyShell());





More information about the cfe-commits mailing list