diff options
| author | Steve Naroff <snaroff@apple.com> | 2008-10-03 00:02:03 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2008-10-03 00:02:03 +0000 |
| commit | 2231569f01416e9cc144cfaf18eb3fc557f7b2a2 (patch) | |
| tree | d7cde14ce354ecc1ca659399a7e90199f07c08ad /clang/lib | |
| parent | ddb14922884f6689d0a686c24e57e9381a34140a (diff) | |
| download | bcm5719-llvm-2231569f01416e9cc144cfaf18eb3fc557f7b2a2.tar.gz bcm5719-llvm-2231569f01416e9cc144cfaf18eb3fc557f7b2a2.zip | |
Add getTypeSpecStartLoc() to VarDecls and FunctionDecls.
This is a temporary solution to help with the block rewriter (though it certainly has general utility).
Once DeclGroup's are implemented, this SourceLocation should be stored with it (since it applies to all the decls).
llvm-svn: 56985
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 11 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 9 |
2 files changed, 13 insertions, 7 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 8bc212d302d..3ddf81974b6 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -51,9 +51,10 @@ ImplicitParamDecl *ImplicitParamDecl::Create(ASTContext &C, DeclContext *DC, 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, @@ -68,9 +69,11 @@ FunctionDecl *FunctionDecl::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, diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 8214fe4c631..1d755efd121 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -661,8 +661,9 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { } 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); @@ -766,7 +767,9 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) { } } 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 |

