[cfe-commits] r39543 - in /cfe/cfe/trunk: Parse/ParseDecl.cpp Sema/Sema.h Sema/SemaDecl.cpp include/clang/Parse/Action.h include/clang/Parse/DeclSpec.h
Steve Naroff
snaroff at apple.com
Wed Jul 11 09:45:26 PDT 2007
Author: snaroff
Date: Wed Jul 11 11:45:26 2007
New Revision: 39543
URL: http://llvm.org/viewvc/llvm-project?rev=39543&view=rev
Log:
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.
Modified:
cfe/cfe/trunk/Parse/ParseDecl.cpp
cfe/cfe/trunk/Sema/Sema.h
cfe/cfe/trunk/Sema/SemaDecl.cpp
cfe/cfe/trunk/include/clang/Parse/Action.h
cfe/cfe/trunk/include/clang/Parse/DeclSpec.h
Modified: cfe/cfe/trunk/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/ParseDecl.cpp?rev=39543&r1=39542&r2=39543&view=diff
==============================================================================
--- cfe/cfe/trunk/Parse/ParseDecl.cpp (original)
+++ cfe/cfe/trunk/Parse/ParseDecl.cpp Wed Jul 11 11:45:26 2007
@@ -397,7 +397,7 @@
// GNU attributes support.
case tok::kw___attribute:
- ParseAttributes();
+ DS.SetAttributeList(ParseAttributes());
continue;
// storage-class-specifier
Modified: cfe/cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/Sema.h?rev=39543&r1=39542&r2=39543&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/Sema.h (original)
+++ cfe/cfe/trunk/Sema/Sema.h Wed Jul 11 11:45:26 2007
@@ -250,8 +250,8 @@
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(),
Modified: cfe/cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Sema/SemaDecl.cpp?rev=39543&r1=39542&r2=39543&view=diff
==============================================================================
--- cfe/cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaDecl.cpp Wed Jul 11 11:45:26 2007
@@ -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 @@
}
/// 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;
}
Modified: cfe/cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/Action.h?rev=39543&r1=39542&r2=39543&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:45:26 2007
@@ -51,6 +51,7 @@
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 @@
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(),
Modified: cfe/cfe/trunk/include/clang/Parse/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/DeclSpec.h?rev=39543&r1=39542&r2=39543&view=diff
==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/cfe/trunk/include/clang/Parse/DeclSpec.h Wed Jul 11 11:45:26 2007
@@ -117,7 +117,7 @@
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 @@
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.
More information about the cfe-commits
mailing list