unsigned SClass : 3;
bool ThreadSpecified : 1;
+ // Move to DeclGroup when it is implemented.
+ SourceLocation TypeSpecStartLoc;
friend class StmtIteratorBase;
protected:
VarDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
- QualType T, StorageClass SC, ScopedDecl *PrevDecl)
+ QualType T, StorageClass SC, ScopedDecl *PrevDecl,
+ SourceLocation TSSL = SourceLocation())
: ValueDecl(DK, DC, L, Id, T, PrevDecl), Init(0),
- ThreadSpecified(false) { SClass = SC; }
+ ThreadSpecified(false), TypeSpecStartLoc(TSSL) { SClass = SC; }
public:
static VarDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
- QualType T, StorageClass S, ScopedDecl *PrevDecl);
+ QualType T, StorageClass S, ScopedDecl *PrevDecl,
+ SourceLocation TypeSpecStartLoc = SourceLocation());
StorageClass getStorageClass() const { return (StorageClass)SClass; }
+ SourceLocation getTypeSpecStartLoc() const { return TypeSpecStartLoc; }
+
const Expr *getInit() const { return (const Expr*) Init; }
Expr *getInit() { return (Expr*) Init; }
void setInit(Expr *I) { Init = (Stmt*) I; }
bool IsInline : 1;
bool IsImplicit : 1;
+ // Move to DeclGroup when it is implemented.
+ SourceLocation TypeSpecStartLoc;
protected:
FunctionDecl(Kind DK, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T,
- StorageClass S, bool isInline, ScopedDecl *PrevDecl)
+ StorageClass S, bool isInline, ScopedDecl *PrevDecl,
+ SourceLocation TSSL = SourceLocation())
: ValueDecl(DK, DC, L, Id, T, PrevDecl),
DeclContext(DK),
ParamInfo(0), Body(0), PreviousDeclaration(0),
- SClass(S), IsInline(isInline), IsImplicit(0) {}
+ SClass(S), IsInline(isInline), IsImplicit(0), TypeSpecStartLoc(TSSL) {}
virtual ~FunctionDecl();
virtual void Destroy(ASTContext& C);
static FunctionDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,
IdentifierInfo *Id, QualType T,
StorageClass S = None, bool isInline = false,
- ScopedDecl *PrevDecl = 0);
+ ScopedDecl *PrevDecl = 0,
+ SourceLocation TSStartLoc = SourceLocation());
+ SourceLocation getTypeSpecStartLoc() const { return TypeSpecStartLoc; }
+
/// getBody - Retrieve the body (definition) of the function. The
/// function body might be in any of the (re-)declarations of this
/// function. The variant that accepts a FunctionDecl pointer will
VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
IdentifierInfo *Id, QualType T,
- StorageClass S, ScopedDecl *PrevDecl) {
+ StorageClass S, ScopedDecl *PrevDecl,
+ SourceLocation TypeSpecStartLoc) {
void *Mem = C.getAllocator().Allocate<VarDecl>();
- return new (Mem) VarDecl(Var, DC, L, Id, T, S, PrevDecl);
+ return new (Mem) VarDecl(Var, DC, L, Id, T, S, PrevDecl, TypeSpecStartLoc);
}
ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
IdentifierInfo *Id, QualType T,
StorageClass S, bool isInline,
- ScopedDecl *PrevDecl) {
+ ScopedDecl *PrevDecl,
+ SourceLocation TypeSpecStartLoc) {
void *Mem = C.getAllocator().Allocate<FunctionDecl>();
- return new (Mem) FunctionDecl(Function, DC, L, Id, T, S, isInline, PrevDecl);
+ return new (Mem) FunctionDecl(Function, DC, L, Id, T, S, isInline, PrevDecl,
+ TypeSpecStartLoc);
}
FieldDecl *FieldDecl::Create(ASTContext &C, SourceLocation L,
} else {
NewFD = FunctionDecl::Create(Context, CurContext,
D.getIdentifierLoc(),
- II, R, SC, isInline,
- LastDeclarator);
+ II, R, SC, isInline, LastDeclarator,
+ // FIXME: Move to DeclGroup...
+ D.getDeclSpec().getSourceRange().getBegin());
}
// Handle attributes.
ProcessDeclAttributes(NewFD, D);
}
}
NewVD = VarDecl::Create(Context, CurContext, D.getIdentifierLoc(),
- II, R, SC, LastDeclarator);
+ II, R, SC, LastDeclarator,
+ // FIXME: Move to DeclGroup...
+ D.getDeclSpec().getSourceRange().getBegin());
NewVD->setThreadSpecified(ThreadSpecified);
}
// Handle attributes prior to checking for duplicates in MergeVarDecl