Move Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl.

Decl is now svelte:-)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41935 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 97e8e07..1a808f8 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -430,8 +430,8 @@
 }
 
 Sema::DeclTy *
-Sema::ParseDeclarator(Scope *S, Declarator &D, DeclTy *lastDeclarator) {
-  Decl *LastDeclarator = (Decl*)lastDeclarator;
+Sema::ParseDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
+  ScopedDecl *LastDeclarator = dyn_cast_or_null<ScopedDecl>((Decl *)lastDecl);
   IdentifierInfo *II = D.getIdentifier();
   
   // All of these full declarators require an identifier.  If it doesn't have
@@ -608,16 +608,17 @@
 /// The declarators are chained together backwards, reverse the list.
 Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) {
   // Often we have single declarators, handle them quickly.
-  Decl *Group = static_cast<Decl*>(group);
-  if (Group == 0)
+  Decl *GroupDecl = static_cast<Decl*>(group);
+  if (GroupDecl == 0)
     return 0;
-    
-  Decl *NewGroup = 0;
+  
+  ScopedDecl *Group = dyn_cast<ScopedDecl>(GroupDecl);
+  ScopedDecl *NewGroup = 0;
   if (Group->getNextDeclarator() == 0) 
     NewGroup = Group;
   else { // reverse the list.
     while (Group) {
-      Decl *Next = Group->getNextDeclarator();
+      ScopedDecl *Next = Group->getNextDeclarator();
       Group->setNextDeclarator(NewGroup);
       NewGroup = Group;
       Group = Next;
@@ -625,7 +626,7 @@
   }
   // Perform semantic analysis that depends on having fully processed both
   // the declarator and initializer.
-  for (Decl *ID = NewGroup; ID; ID = ID->getNextDeclarator()) {
+  for (ScopedDecl *ID = NewGroup; ID; ID = ID->getNextDeclarator()) {
     VarDecl *IDecl = dyn_cast<VarDecl>(ID);
     if (!IDecl)
       continue;
@@ -846,7 +847,7 @@
 
 
 TypedefDecl *Sema::ParseTypedefDecl(Scope *S, Declarator &D,
-                                    Decl *LastDeclarator) {
+                                    ScopedDecl *LastDeclarator) {
   assert(D.getIdentifier() && "Wrong callback for declspec without declarator");
   
   QualType T = GetTypeForDeclarator(D, S);