From 1bfe1c2129771c06fb58ae5e8c079ae30e138309 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 3 Oct 2008 02:03:53 +0000 Subject: [PATCH] Pass postfix attributes to ActOnFields. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56992 91177308-0d34-0410-b5e6-96231b3b80d8 --- Driver/PrintParserCallbacks.cpp | 3 ++- lib/AST/ASTContext.cpp | 2 ++ lib/Parse/ParseDecl.cpp | 9 +++++---- lib/Parse/ParseObjc.cpp | 2 +- lib/Sema/Sema.h | 3 ++- lib/Sema/SemaDecl.cpp | 3 ++- lib/Sema/SemaDeclCXX.cpp | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Driver/PrintParserCallbacks.cpp b/Driver/PrintParserCallbacks.cpp index caae11b861..b616268376 100644 --- a/Driver/PrintParserCallbacks.cpp +++ b/Driver/PrintParserCallbacks.cpp @@ -205,7 +205,8 @@ namespace { virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclTy *TagDecl, DeclTy **Fields, unsigned NumFields, - SourceLocation LBrac, SourceLocation RBrac) { + SourceLocation LBrac, SourceLocation RBrac, + AttributeList *AttrList) { llvm::cout << __FUNCTION__ << "\n"; } diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index feb1bad4f9..b373f3ac2a 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -492,6 +492,8 @@ ASTContext::getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) { /// specified record (struct/union/class), which indicates its size and field /// position information. const ASTRecordLayout &ASTContext::getASTRecordLayout(const RecordDecl *D) { + fprintf(stderr, "%p\n", D->getAttr()); + D = D->getDefinition(*this); assert(D && "Cannot get layout of forward declarations!"); diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 80970a2f14..5ea9d13b03 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -764,14 +764,15 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, SourceLocation RBraceLoc = MatchRHSPunctuation(tok::r_brace, LBraceLoc); - Actions.ActOnFields(CurScope, - RecordLoc,TagDecl,&FieldDecls[0],FieldDecls.size(), - LBraceLoc, RBraceLoc); - AttributeList *AttrList = 0; // If attributes exist after struct contents, parse them. if (Tok.is(tok::kw___attribute)) AttrList = ParseAttributes(); // FIXME: where should I put them? + + Actions.ActOnFields(CurScope, + RecordLoc,TagDecl,&FieldDecls[0],FieldDecls.size(), + LBraceLoc, RBraceLoc, + AttrList); } diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index c48cc8aa1a..0222b0401a 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -900,7 +900,7 @@ void Parser::ParseObjCClassInstanceVariables(DeclTy *interfaceDecl, // for code rewriting tools that need to be aware of the empty list. Actions.ActOnFields(CurScope, atLoc, interfaceDecl, &AllIvarDecls[0], AllIvarDecls.size(), - LBraceLoc, RBraceLoc); + LBraceLoc, RBraceLoc, 0); return; } diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index 696a6f4194..36f5de8bb3 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -282,7 +282,8 @@ private: virtual void ActOnFields(Scope* S, SourceLocation RecLoc, DeclTy *TagDecl, DeclTy **Fields, unsigned NumFields, - SourceLocation LBrac, SourceLocation RBrac); + SourceLocation LBrac, SourceLocation RBrac, + AttributeList *AttrList); virtual DeclTy *ActOnEnumConstant(Scope *S, DeclTy *EnumDecl, DeclTy *LastEnumConstant, SourceLocation IdLoc, IdentifierInfo *Id, diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 1d755efd12..315bf98af5 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2111,7 +2111,8 @@ Sema::DeclTy *Sema::ActOnIvar(Scope *S, void Sema::ActOnFields(Scope* S, SourceLocation RecLoc, DeclTy *RecDecl, DeclTy **Fields, unsigned NumFields, - SourceLocation LBrac, SourceLocation RBrac) { + SourceLocation LBrac, SourceLocation RBrac, + AttributeList *Attrs) { Decl *EnclosingDecl = static_cast(RecDecl); assert(EnclosingDecl && "missing record or interface decl"); RecordDecl *Record = dyn_cast(EnclosingDecl); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 85097cabd4..c46954568f 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -461,7 +461,7 @@ void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc, SourceLocation RBrac) { ActOnFields(S, RLoc, TagDecl, (DeclTy**)FieldCollector->getCurFields(), - FieldCollector->getCurNumFields(), LBrac, RBrac); + FieldCollector->getCurNumFields(), LBrac, RBrac, 0); } void Sema::ActOnFinishCXXClassDef(DeclTy *D) {