#include "Sema.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
+#include "clang/AST/Attr.h"
#include "clang/AST/Builtins.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
FunctionDecl *NewFD = new FunctionDecl(D.getIdentifierLoc(), II, R, SC,
D.getDeclSpec().isInlineSpecified(),
- LastDeclarator,
- D.getDeclSpec().getAttributes());
-
- // Transfer ownership of DeclSpec attributes to FunctionDecl
+ LastDeclarator);
+ // FIXME: Handle attributes.
D.getDeclSpec().clearAttributes();
// Merge the decl with the existing one if appropriate. Since C functions
parmDeclType = Context.getPointerType(parmDeclType);
ParmVarDecl *New = new ParmVarDecl(PI.IdentLoc, II, parmDeclType,
- VarDecl::None, 0, PI.AttrList);
+ VarDecl::None, 0);
+ // FIXME: Handle attributes
+
if (PI.InvalidType)
New->setInvalidDecl();
#include "clang/AST/Type.h"
#include "clang/Basic/SourceLocation.h"
-#include "clang/Parse/AttributeList.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/Bitcode/SerializationFwd.h"
}
namespace clang {
+class Attr;
class Expr;
class Stmt;
class StringLiteral;
class ValueDecl : public ScopedDecl {
QualType DeclType;
- /// Attributes - Linked list of attributes that are attached to this
+ /// Attrs - Linked list of attributes that are attached to this
/// function.
- AttributeList *Attributes;
+ Attr *Attrs;
protected:
ValueDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T,
- ScopedDecl *PrevDecl, AttributeList *A = 0)
- : ScopedDecl(DK, L, Id, PrevDecl), DeclType(T), Attributes(A) {}
+ ScopedDecl *PrevDecl)
+ : ScopedDecl(DK, L, Id, PrevDecl), DeclType(T) {}
public:
QualType getType() const { return DeclType; }
void setType(QualType newType) { DeclType = newType; }
QualType getCanonicalType() const { return DeclType.getCanonicalType(); }
- AttributeList *getAttributes() const { return Attributes; }
+ void addAttr(Attr *attr);
+ const Attr *getAttrs() const { return Attrs; }
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) {
static bool classof(const VarDecl *D) { return true; }
protected:
VarDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T,
- StorageClass SC, ScopedDecl *PrevDecl, AttributeList *A = 0)
- : ValueDecl(DK, L, Id, T, PrevDecl, A), Init(0) { SClass = SC; }
+ StorageClass SC, ScopedDecl *PrevDecl)
+ : ValueDecl(DK, L, Id, T, PrevDecl), Init(0) { SClass = SC; }
private:
Expr *Init;
// FIXME: This can be packed into the bitfields in Decl.
class BlockVarDecl : public VarDecl {
public:
BlockVarDecl(SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass S,
- ScopedDecl *PrevDecl, AttributeList *A = 0)
- : VarDecl(BlockVar, L, Id, T, S, PrevDecl, A) {}
+ ScopedDecl *PrevDecl)
+ : VarDecl(BlockVar, L, Id, T, S, PrevDecl) {}
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return D->getKind() == BlockVar; }
class FileVarDecl : public VarDecl {
public:
FileVarDecl(SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass S,
- ScopedDecl *PrevDecl, AttributeList *A = 0)
- : VarDecl(FileVar, L, Id, T, S, PrevDecl, A) {}
+ ScopedDecl *PrevDecl)
+ : VarDecl(FileVar, L, Id, T, S, PrevDecl) {}
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return D->getKind() == FileVar; }
class ParmVarDecl : public VarDecl {
public:
ParmVarDecl(SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass S,
- ScopedDecl *PrevDecl, AttributeList *A = 0)
- : VarDecl(ParmVar, L, Id, T, S, PrevDecl, A),
+ ScopedDecl *PrevDecl)
+ : VarDecl(ParmVar, L, Id, T, S, PrevDecl),
objcDeclQualifier(OBJC_TQ_None) {}
ObjCDeclQualifier getObjCDeclQualifier() const { return objcDeclQualifier; }
};
FunctionDecl(SourceLocation L, IdentifierInfo *Id, QualType T,
StorageClass S = None, bool isInline = false,
- ScopedDecl *PrevDecl = 0, AttributeList *Attrs = 0)
- : ValueDecl(Function, L, Id, T, PrevDecl, Attrs),
+ ScopedDecl *PrevDecl = 0)
+ : ValueDecl(Function, L, Id, T, PrevDecl),
ParamInfo(0), Body(0), DeclChain(0), SClass(S), IsInline(isInline) {}
virtual ~FunctionDecl();