virtual DeclTy *ActOnTag(Scope *S, unsigned TagSpec, TagKind TK,
SourceLocation KWLoc, const CXXScopeSpec &SS,
IdentifierInfo *Name, SourceLocation NameLoc,
- AttributeList *Attr) {
+ AttributeList *Attr, AccessSpecifier AS) {
// TagType is an instance of DeclSpec::TST, indicating what kind of tag this
// is (struct/union/enum/class).
return 0;
#define LLVM_CLANG_PARSE_PARSER_H
#include "clang/Lex/Preprocessor.h"
+#include "clang/Parse/AccessSpecifier.h"
#include "clang/Parse/Action.h"
#include "clang/Parse/DeclSpec.h"
#include "llvm/ADT/OwningPtr.h"
DeclTy *ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D);
DeclTy *ParseFunctionStatementBody(DeclTy *Decl);
void ParseDeclarationSpecifiers(DeclSpec &DS,
- TemplateParameterLists *TemplateParams = 0);
+ TemplateParameterLists *TemplateParams = 0,
+ AccessSpecifier AS = AS_none);
bool ParseOptionalTypeSpecifier(DeclSpec &DS, int &isInvalid,
const char *&PrevSpec,
TemplateParameterLists *TemplateParams = 0);
void ParseObjCTypeQualifierList(ObjCDeclSpec &DS);
- void ParseEnumSpecifier(DeclSpec &DS);
+ void ParseEnumSpecifier(DeclSpec &DS, AccessSpecifier AS = AS_none);
void ParseEnumBody(SourceLocation StartLoc, DeclTy *TagDecl);
void ParseStructUnionBody(SourceLocation StartLoc, unsigned TagType,
DeclTy *TagDecl);
TypeTy *ParseClassName(SourceLocation &EndLocation,
const CXXScopeSpec *SS = 0);
void ParseClassSpecifier(DeclSpec &DS,
- TemplateParameterLists *TemplateParams = 0);
+ TemplateParameterLists *TemplateParams = 0,
+ AccessSpecifier AS = AS_none);
void ParseCXXMemberSpecification(SourceLocation StartLoc, unsigned TagType,
DeclTy *TagDecl);
DeclTy *ParseCXXClassMemberDeclaration(AccessSpecifier AS);
/// [C++] 'explicit'
///
void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
- TemplateParameterLists *TemplateParams){
+ TemplateParameterLists *TemplateParams,
+ AccessSpecifier AS){
DS.SetRangeStart(Tok.getLocation());
while (1) {
int isInvalid = false;
case tok::kw_class:
case tok::kw_struct:
case tok::kw_union:
- ParseClassSpecifier(DS, TemplateParams);
+ ParseClassSpecifier(DS, TemplateParams, AS);
continue;
// enum-specifier:
case tok::kw_enum:
- ParseEnumSpecifier(DS);
+ ParseEnumSpecifier(DS, AS);
continue;
// cv-qualifier:
/// [C++] elaborated-type-specifier:
/// [C++] 'enum' '::'[opt] nested-name-specifier[opt] identifier
///
-void Parser::ParseEnumSpecifier(DeclSpec &DS) {
+void Parser::ParseEnumSpecifier(DeclSpec &DS, AccessSpecifier AS) {
assert(Tok.is(tok::kw_enum) && "Not an enum specifier");
SourceLocation StartLoc = ConsumeToken();
else
TK = Action::TK_Reference;
DeclTy *TagDecl = Actions.ActOnTag(CurScope, DeclSpec::TST_enum, TK, StartLoc,
- SS, Name, NameLoc, Attr);
+ SS, Name, NameLoc, Attr, AS);
if (Tok.is(tok::l_brace))
ParseEnumBody(StartLoc, TagDecl);
/// 'struct'
/// 'union'
void Parser::ParseClassSpecifier(DeclSpec &DS,
- TemplateParameterLists *TemplateParams) {
+ TemplateParameterLists *TemplateParams,
+ AccessSpecifier AS) {
assert((Tok.is(tok::kw_class) ||
Tok.is(tok::kw_struct) ||
Tok.is(tok::kw_union)) &&
TemplateParams->size()));
else
TagOrTempResult = Actions.ActOnTag(CurScope, TagType, TK, StartLoc, SS, Name,
- NameLoc, Attr);
+ NameLoc, Attr, AS);
// Parse the optional base clause (C++ only).
if (getLang().CPlusPlus && Tok.is(tok::colon))
// decl-specifier-seq:
// Parse the common declaration-specifiers piece.
DeclSpec DS;
- ParseDeclarationSpecifiers(DS);
+ ParseDeclarationSpecifiers(DS, 0, AS);
if (Tok.is(tok::semi)) {
ConsumeToken();
virtual DeclTy *ActOnTag(Scope *S, unsigned TagSpec, TagKind TK,
SourceLocation KWLoc, const CXXScopeSpec &SS,
IdentifierInfo *Name, SourceLocation NameLoc,
- AttributeList *Attr);
+ AttributeList *Attr, AccessSpecifier AS);
virtual void ActOnDefs(Scope *S, DeclTy *TagD, SourceLocation DeclStart,
IdentifierInfo *ClassName,
Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagKind TK,
SourceLocation KWLoc, const CXXScopeSpec &SS,
IdentifierInfo *Name, SourceLocation NameLoc,
- AttributeList *Attr) {
+ AttributeList *Attr, AccessSpecifier AS) {
// If this is not a definition, it must have a name.
assert((Name != 0 || TK == TK_Definition) &&
"Nameless record must be a definition!");
// lexical context will be different from the semantic context.
New->setLexicalDeclContext(CurContext);
+ if (AS != AS_none)
+ New->setAccess(AS);
+
if (TK == TK_Definition)
New->startDefinition();
EnumDecl *Enum = EnumDecl::Create(SemaRef.Context, Owner,
D->getLocation(), D->getIdentifier(),
/*PrevDecl=*/0);
+ Enum->setAccess(D->getAccess());
Owner->addDecl(Enum);
Enum->startDefinition();
virtual DeclTy *ActOnTag(Scope *S, unsigned TagType, TagKind TK,
SourceLocation KWLoc, const CXXScopeSpec &SS,
IdentifierInfo *Name, SourceLocation NameLoc,
- AttributeList *Attr) {
+ AttributeList *Attr, AccessSpecifier AS) {
// TagType is an instance of DeclSpec::TST, indicating what kind of tag this
// is (struct/union/enum/class).
llvm::cout << __FUNCTION__ << "\n";