diff options
| author | Steve Naroff <snaroff@apple.com> | 2007-09-13 21:41:19 +0000 |
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2007-09-13 21:41:19 +0000 |
| commit | 9def2b15c1193ee423ffe11125154bd86dd71a1d (patch) | |
| tree | 8c006647b8f389d9246fccf212784c3cdc84268a /clang/Sema/SemaDecl.cpp | |
| parent | 011f91b5b24cc27071877f3d75f961c187afc5d4 (diff) | |
| download | bcm5719-llvm-9def2b15c1193ee423ffe11125154bd86dd71a1d.tar.gz bcm5719-llvm-9def2b15c1193ee423ffe11125154bd86dd71a1d.zip | |
Phase 2 of making the Decl class more lightweight...
Move Identifier/Loc instance variables (and associated getters/setters) down from Decl to ScopedDecl/FieldDecl.
Objc AST's can now inherit from Decl without getting instance variables and types that are C specific. For now, I am keeping NextDeclarator, since I believe it may be useful to ObjC. If not, it can be moved later.
llvm-svn: 41934
Diffstat (limited to 'clang/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/Sema/SemaDecl.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp index 02d93504d3e..97e8e07aafb 100644 --- a/clang/Sema/SemaDecl.cpp +++ b/clang/Sema/SemaDecl.cpp @@ -147,7 +147,7 @@ ScopedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, Scope *S /// and scope as a previous declaration 'Old'. Figure out how to resolve this /// situation, merging decls or emitting diagnostics as appropriate. /// -TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) { +TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, ScopedDecl *OldD) { // Verify the old decl was also a typedef. TypedefDecl *Old = dyn_cast<TypedefDecl>(OldD); if (!Old) { @@ -169,7 +169,7 @@ TypedefDecl *Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) { /// and scope as a previous declaration 'Old'. Figure out how to resolve this /// situation, merging decls or emitting diagnostics as appropriate. /// -FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { +FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, ScopedDecl *OldD) { // Verify the old decl was also a function. FunctionDecl *Old = dyn_cast<FunctionDecl>(OldD); if (!Old) { @@ -202,7 +202,7 @@ FunctionDecl *Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { /// FIXME: Need to carefully consider tentative definition rules (C99 6.9.2p2). /// For example, we incorrectly complain about i1, i4 from C99 6.9.2p4. /// -VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) { +VarDecl *Sema::MergeVarDecl(VarDecl *New, ScopedDecl *OldD) { // Verify the old decl was also a variable. VarDecl *Old = dyn_cast<VarDecl>(OldD); if (!Old) { @@ -571,7 +571,8 @@ void Sema::AddInitializerToDecl(DeclTy *dcl, ExprTy *init) { VarDecl *VDecl = dyn_cast<VarDecl>(RealDecl); if (!VDecl) { - Diag(RealDecl->getLocation(), diag::err_illegal_initializer); + Diag(dyn_cast<ScopedDecl>(RealDecl)->getLocation(), + diag::err_illegal_initializer); RealDecl->setInvalidDecl(); return; } @@ -1280,7 +1281,8 @@ Sema::DeclTy *Sema::ParseEnumConstant(Scope *S, DeclTy *theEnumDecl, // Verify that there isn't already something declared with this name in this // scope. - if (Decl *PrevDecl = LookupScopedDecl(Id, Decl::IDNS_Ordinary, IdLoc, S)) { + if (ScopedDecl *PrevDecl = LookupScopedDecl(Id, Decl::IDNS_Ordinary, + IdLoc, S)) { if (S->isDeclScope(PrevDecl)) { if (isa<EnumConstantDecl>(PrevDecl)) Diag(IdLoc, diag::err_redefinition_of_enumerator, Id->getName()); |

