[cfe-commits] r80420 - in /cfe/trunk/lib: AST/DeclBase.cpp Sema/SemaDeclCXX.cpp Sema/SemaTemplateInstantiateDecl.cpp
John McCall
rjmccall at apple.com
Fri Aug 28 20:50:19 PDT 2009
Author: rjmccall
Date: Fri Aug 28 22:50:18 2009
New Revision: 80420
URL: http://llvm.org/viewvc/llvm-project?rev=80420&view=rev
Log:
For consistency, just make friend declarations AS_public.
Modified:
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=80420&r1=80419&r2=80420&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Fri Aug 28 22:50:18 2009
@@ -379,16 +379,8 @@
#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");
}
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=80420&r1=80419&r2=80420&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Aug 28 22:50:18 2009
@@ -3661,6 +3661,7 @@
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 @@
FriendDecl *FrD = FriendDecl::Create(Context, CurContext,
D.getIdentifierLoc(), FD,
DS.getFriendSpecLoc());
+ FrD->setAccess(AS_public);
CurContext->addDecl(FrD);
return DeclPtrTy::make(FD);
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=80420&r1=80419&r2=80420&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Fri Aug 28 22:50:18 2009
@@ -278,6 +278,7 @@
FriendDecl *FD =
FriendDecl::Create(SemaRef.Context, Owner, D->getLocation(), FU,
D->getFriendLoc());
+ FD->setAccess(AS_public);
Owner->addDecl(FD);
return FD;
}
More information about the cfe-commits
mailing list