bool FS_virtual_specified : 1;
bool FS_explicit_specified : 1;
+ // friend-specifier
+ bool Friend_specified : 1;
+
/// TypeRep - This contains action-specific information about a specific TST.
/// For example, for a typedef or struct, it might contain the declaration for
/// these.
SourceLocation TSWLoc, TSCLoc, TSSLoc, TSTLoc;
SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc;
SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc;
+ SourceLocation FriendLoc;
bool BadSpecifier(TST T, const char *&PrevSpec);
bool BadSpecifier(TQ T, const char *&PrevSpec);
FS_inline_specified(false),
FS_virtual_specified(false),
FS_explicit_specified(false),
+ Friend_specified(false),
TypeRep(0),
AttrList(0),
ProtocolQualifiers(0),
bool SetFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec);
bool SetFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec);
+ bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec);
+
/// AddAttributes - contatenates two attribute lists.
/// The GCC attribute syntax allows for the following:
///
return false;
}
+bool DeclSpec::SetFriendSpec(SourceLocation Loc, const char *&PrevSpec) {
+ if (Friend_specified) {
+ PrevSpec = "friend";
+ return true;
+ }
+
+ Friend_specified = true;
+ FriendLoc = Loc;
+ return false;
+}
/// Finish - This does final analysis of the declspec, rejecting things like
/// "_Imaginary" (lacking an FP type). This returns a diagnostic to issue or
/// [C99] 'inline'
/// [C++] 'virtual'
/// [C++] 'explicit'
+/// 'friend': [C++ dcl.friend]
+
///
void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
TemplateParameterLists *TemplateParams,
isInvalid = DS.SetFunctionSpecExplicit(Loc, PrevSpec);
break;
+ // friend
+ case tok::kw_friend:
+ isInvalid = DS.SetFriendSpec(Loc, PrevSpec);
+ break;
+
// type-specifier
case tok::kw_short:
isInvalid = DS.SetTypeSpecWidth(DeclSpec::TSW_short, Loc, PrevSpec);