Add an ActOnFriendDecl and call it for friend class decls.

llvm-svn: 71482
This commit is contained in:
Anders Carlsson 2009-05-11 22:27:47 +00:00
parent 22e3784c79
commit f83c9faa2f
3 changed files with 19 additions and 3 deletions

View File

@ -933,6 +933,13 @@ public:
return DeclPtrTy();
}
/// ActOnFriendDecl - This action is called when a friend declaration is
/// encountered. Returns false on success.
virtual bool ActOnFriendDecl(Scope *S, SourceLocation FriendLoc,
DeclPtrTy Dcl) {
return false;
}
//===------------------------- C++ Expressions --------------------------===//

View File

@ -284,6 +284,7 @@ public:
bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec);
bool isFriendSpecified() const { return Friend_specified; }
SourceLocation getFriendSpecLoc() const { return FriendLoc; }
/// AddAttributes - contatenates two attribute lists.
/// The GCC attribute syntax allows for the following:

View File

@ -525,10 +525,18 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
}
const char *PrevSpec = 0;
if (TagOrTempResult.isInvalid())
if (TagOrTempResult.isInvalid()) {
DS.SetTypeSpecError();
else if (DS.SetTypeSpecType(TagType, StartLoc, PrevSpec,
TagOrTempResult.get().getAs<void>()))
return;
}
if (DS.isFriendSpecified() &&
!Actions.ActOnFriendDecl(CurScope, DS.getFriendSpecLoc(),
TagOrTempResult.get()))
return;
if (DS.SetTypeSpecType(TagType, StartLoc, PrevSpec,
TagOrTempResult.get().getAs<void>()))
Diag(StartLoc, diag::err_invalid_decl_spec_combination) << PrevSpec;
}