forked from OSchip/llvm-project
Re-enable CheckAccessDeclContext and make sure it doesn't trigger assertions.
llvm-svn: 113413
This commit is contained in:
parent
73f59c433d
commit
260b4a8e92
|
@ -112,6 +112,8 @@ class AccessSpecDecl : public Decl {
|
|||
: 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 @@ public:
|
|||
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()); }
|
||||
|
|
|
@ -418,18 +418,20 @@ SourceLocation Decl::getBodyRBrace() const {
|
|||
|
||||
#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 &&
|
||||
|
|
|
@ -1308,8 +1308,7 @@ Decl *ASTReader::ReadDeclRecord(unsigned Index, DeclID ID) {
|
|||
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());
|
||||
|
|
Loading…
Reference in New Issue