Refactor FieldDecls to be ValueDecls instead of NamedDecls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64231 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 15945af..1ea0150 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -662,15 +662,13 @@
 
 /// FieldDecl - An instance of this class is created by Sema::ActOnField to 
 /// represent a member of a struct/union/class.
-class FieldDecl : public NamedDecl {
+class FieldDecl : public ValueDecl {
   bool Mutable : 1;
-  QualType DeclType;  
   Expr *BitWidth;
 protected:
   FieldDecl(Kind DK, DeclContext *DC, SourceLocation L, 
             IdentifierInfo *Id, QualType T, Expr *BW, bool Mutable)
-    : NamedDecl(DK, DC, L, Id), Mutable(Mutable), DeclType(T), 
-      BitWidth(BW)
+    : ValueDecl(DK, DC, L, Id, T), Mutable(Mutable), BitWidth(BW)
       { }
 
 public:
@@ -678,8 +676,6 @@
                            IdentifierInfo *Id, QualType T, Expr *BW, 
                            bool Mutable);
 
-  QualType getType() const { return DeclType; }
-
   /// isMutable - Determines whether this field is mutable (C++ only).
   bool isMutable() const { return Mutable; }
 
diff --git a/include/clang/AST/DeclNodes.def b/include/clang/AST/DeclNodes.def
index 195553c..602c37e 100644
--- a/include/clang/AST/DeclNodes.def
+++ b/include/clang/AST/DeclNodes.def
@@ -72,9 +72,6 @@
 DECL(TranslationUnit, Decl)
 ABSTRACT_DECL(Named,  Decl)
   DECL(OverloadedFunction, NamedDecl)
-  DECL(Field, NameDecl)
-    DECL(ObjCIvar, FieldDecl)
-    DECL(ObjCAtDefsField, FieldDecl)
   DECL(Namespace, NamedDecl)
   DECL(UsingDirective, NamedDecl)
   ABSTRACT_DECL(Type, NamedDecl)
@@ -91,6 +88,9 @@
         DECL(CXXConstructor, CXXMethodDecl)
         DECL(CXXDestructor, CXXMethodDecl)
         DECL(CXXConversion, CXXMethodDecl)
+    DECL(Field, ValueDecl)
+      DECL(ObjCIvar, FieldDecl)
+      DECL(ObjCAtDefsField, FieldDecl)
     DECL(Var, ValueDecl)
       DECL(ImplicitParam, VarDecl)
       DECL(CXXClassVar, VarDecl)
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index ea027df..e4534a2 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -437,7 +437,7 @@
 void FieldDecl::EmitImpl(Serializer& S) const {
   S.EmitBool(Mutable);
   S.Emit(getType());
-  NamedDecl::EmitInRec(S);
+  ValueDecl::EmitInRec(S);
   S.EmitOwnedPtr(BitWidth);  
 }
 
@@ -445,8 +445,7 @@
   FieldDecl* decl = new (C) FieldDecl(Field, 0, SourceLocation(), NULL, 
                                         QualType(), 0, false);
   decl->Mutable = D.ReadBool();
-  decl->DeclType.ReadBackpatch(D);  
-  decl->ReadInRec(D, C);
+  decl->ValueDecl::ReadInRec(D, C);
   decl->BitWidth = D.ReadOwnedPtr<Expr>(C);
   return decl;
 }