forked from OSchip/llvm-project
Bug #:
Submitted by: Reviewed by: After speaking with Chris, decided not to have GCC "attributes" inherit from Decl. This will enable us to grow the attribute hierarchy over time without effecting Decls. llvm-svn: 39543
This commit is contained in:
parent
6a0675f8a4
commit
4555292b1e
|
@ -397,7 +397,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) {
|
|||
|
||||
// GNU attributes support.
|
||||
case tok::kw___attribute:
|
||||
ParseAttributes();
|
||||
DS.SetAttributeList(ParseAttributes());
|
||||
continue;
|
||||
|
||||
// storage-class-specifier
|
||||
|
|
|
@ -250,8 +250,8 @@ public:
|
|||
tok::TokenKind Kind);
|
||||
|
||||
/// ParseAttribute GCC __attribute__
|
||||
virtual DeclTy *ParseAttribute(
|
||||
IdentifierInfo *AttrName, SourceLocation AttrNameLoc, DeclTy *PrevAttr,
|
||||
virtual AttrTy *ParseAttribute(
|
||||
IdentifierInfo *AttrName, SourceLocation AttrNameLoc, AttrTy *PrevAttr,
|
||||
IdentifierInfo *ParmName = 0, SourceLocation ParmNameLoc = SourceLocation(),
|
||||
ExprTy **Args = 0, unsigned NumArgs = 0,
|
||||
SourceLocation LParenLoc = SourceLocation(),
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/AST/Type.h"
|
||||
#include "clang/AST/Attr.h"
|
||||
#include "clang/Parse/DeclSpec.h"
|
||||
#include "clang/Parse/Scope.h"
|
||||
#include "clang/Lex/IdentifierTable.h"
|
||||
|
@ -848,15 +849,15 @@ void Sema::AddTopLevelDecl(Decl *current, Decl *last) {
|
|||
}
|
||||
|
||||
/// ParseAttribute GCC __attribute__
|
||||
Sema::DeclTy *Sema::ParseAttribute(
|
||||
IdentifierInfo *AttrName, SourceLocation AttrNameLoc, DeclTy *PrevAttr,
|
||||
Sema::AttrTy *Sema::ParseAttribute(
|
||||
IdentifierInfo *AttrName, SourceLocation AttrNameLoc, AttrTy *PrevAttr,
|
||||
IdentifierInfo *ParmName, SourceLocation ParmNameLoc,
|
||||
ExprTy **Args, unsigned NumArgs,
|
||||
SourceLocation LParenLoc, SourceLocation RParenLoc) {
|
||||
AttributeDecl *attrib = new AttributeDecl(AttrNameLoc, AttrName, ParmName,
|
||||
(Expr **)Args, NumArgs);
|
||||
Attr *attrib = new Attr(AttrNameLoc, AttrName, ParmName, (Expr **)Args,
|
||||
NumArgs);
|
||||
if (PrevAttr)
|
||||
// reuse Decl's "Next" pointer for chaining the attribute list
|
||||
attrib->setNext(static_cast<Decl *>(PrevAttr));
|
||||
attrib->setNext(static_cast<Attr *>(PrevAttr));
|
||||
return attrib;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
typedef void StmtTy;
|
||||
typedef void DeclTy;
|
||||
typedef void TypeTy;
|
||||
typedef void AttrTy;
|
||||
|
||||
/// ActionResult - This structure is used while parsing/acting on expressions,
|
||||
/// stmts, etc. It encapsulates both the object returned by the action, plus
|
||||
|
@ -357,9 +358,9 @@ public:
|
|||
tok::TokenKind Kind) {
|
||||
return 0;
|
||||
}
|
||||
/// ParseAttribute
|
||||
virtual DeclTy *ParseAttribute(
|
||||
IdentifierInfo *AttrName, SourceLocation AttrNameLoc, DeclTy *PrevAttr,
|
||||
/// ParseAttribute GCC __attribute__
|
||||
virtual AttrTy *ParseAttribute(
|
||||
IdentifierInfo *AttrName, SourceLocation AttrNameLoc, AttrTy *PrevAttr,
|
||||
IdentifierInfo *ParmName = 0, SourceLocation ParmNameLoc = SourceLocation(),
|
||||
ExprTy **Args = 0, unsigned NumArgs = 0,
|
||||
SourceLocation LParenLoc = SourceLocation(),
|
||||
|
|
|
@ -117,7 +117,7 @@ private:
|
|||
void *TypeRep;
|
||||
|
||||
// attributes.
|
||||
// FIXME: implement declspec attributes.
|
||||
void *AttributeList;
|
||||
|
||||
// SourceLocation info. These are null if the item wasn't specified or if
|
||||
// the setting was synthesized.
|
||||
|
@ -218,6 +218,9 @@ public:
|
|||
|
||||
bool SetFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec);
|
||||
|
||||
/// attributes
|
||||
void SetAttributeList(void *alist) { AttributeList = alist; }
|
||||
|
||||
/// Finish - This does final analysis of the declspec, issuing diagnostics for
|
||||
/// things like "_Imaginary" (lacking an FP type). After calling this method,
|
||||
/// DeclSpec is guaranteed self-consistent, even if an error occurred.
|
||||
|
|
Loading…
Reference in New Issue