diff options
author | John McCall <rjmccall@apple.com> | 2009-08-06 02:15:43 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-08-06 02:15:43 +0000 |
commit | 67d1a67f3db2f1aa69083c5c94164d6e0ee05b32 (patch) | |
tree | 7a033d2138cdd888dc7e6c88b60bd6ae8b43f8bf /lib/Parse/ParseDecl.cpp | |
parent | 32d96b08dbfb6fbe88d74a9a85aad200ceae656a (diff) |
First pass at friend semantics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78274 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 42ef7e6c29..a80f57c8ca 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -708,7 +708,8 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, /// void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, const ParsedTemplateInfo &TemplateInfo, - AccessSpecifier AS) { + AccessSpecifier AS, + DeclSpecContext DSContext) { DS.SetRangeStart(Tok.getLocation()); while (1) { bool isInvalid = false; @@ -968,7 +969,13 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // friend case tok::kw_friend: - isInvalid = DS.SetFriendSpec(Loc, PrevSpec, DiagID); + if (DSContext == DSC_class) + isInvalid = DS.SetFriendSpec(Loc, PrevSpec, DiagID); + else { + PrevSpec = ""; // not actually used by the diagnostic + DiagID = diag::err_friend_invalid_in_context; + isInvalid = true; + } break; // type-specifier |