For consistency, just make friend declarations AS_public.

llvm-svn: 80420
This commit is contained in:
John McCall 2009-08-29 03:50:18 +00:00
parent e3e2047873
commit 75c03bbb0c
3 changed files with 5 additions and 10 deletions

View File

@ -379,16 +379,8 @@ SourceLocation Decl::getBodyRBrace() const {
#ifndef NDEBUG
void Decl::CheckAccessDeclContext() const {
if (isa<TranslationUnitDecl>(this) ||
!isa<CXXRecordDecl>(getDeclContext()))
return;
// FIXME: Should friend declarations have access specifiers?
if (isa<FriendDecl>(this) ||
getFriendObjectKind() != FOK_None)
return;
assert(Access != AS_none &&
assert((Access != AS_none || isa<TranslationUnitDecl>(this) ||
!isa<CXXRecordDecl>(getDeclContext())) &&
"Access specifier is AS_none inside a record decl");
}

View File

@ -3661,6 +3661,7 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S,
FriendDecl *FD = FriendDecl::Create(Context, CurContext, Loc, FU,
DS.getFriendSpecLoc());
FD->setAccess(AS_public);
CurContext->addDecl(FD);
return DeclPtrTy::make(FD);
@ -3829,6 +3830,7 @@ Sema::DeclPtrTy Sema::ActOnFriendFunctionDecl(Scope *S,
FriendDecl *FrD = FriendDecl::Create(Context, CurContext,
D.getIdentifierLoc(), FD,
DS.getFriendSpecLoc());
FrD->setAccess(AS_public);
CurContext->addDecl(FrD);
return DeclPtrTy::make(FD);

View File

@ -278,6 +278,7 @@ Decl *TemplateDeclInstantiator::VisitFriendDecl(FriendDecl *D) {
FriendDecl *FD =
FriendDecl::Create(SemaRef.Context, Owner, D->getLocation(), FU,
D->getFriendLoc());
FD->setAccess(AS_public);
Owner->addDecl(FD);
return FD;
}