[cfe-commits] r64231 - in /cfe/trunk: include/clang/AST/Decl.h include/clang/AST/DeclNodes.def lib/AST/DeclSerialization.cpp

Douglas Gregor dgregor at apple.com
Tue Feb 10 12:52:20 PST 2009


On Feb 10, 2009, at 12:06 PM, Mike Stump wrote:

> Author: mrs
> Date: Tue Feb 10 14:06:48 2009
> New Revision: 64231
>
> URL: http://llvm.org/viewvc/llvm-project?rev=64231&view=rev
> Log:
> Refactor FieldDecls to be ValueDecls instead of NamedDecls.

Ah, good idea. Thanks!

	- Doug

> Modified:
>    cfe/trunk/include/clang/AST/Decl.h
>    cfe/trunk/include/clang/AST/DeclNodes.def
>    cfe/trunk/lib/AST/DeclSerialization.cpp
>
> Modified: cfe/trunk/include/clang/AST/Decl.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=64231&r1=64230&r2=64231&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/AST/Decl.h (original)
> +++ cfe/trunk/include/clang/AST/Decl.h Tue Feb 10 14:06:48 2009
> @@ -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; }
>
>
> Modified: cfe/trunk/include/clang/AST/DeclNodes.def
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclNodes.def?rev=64231&r1=64230&r2=64231&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/include/clang/AST/DeclNodes.def (original)
> +++ cfe/trunk/include/clang/AST/DeclNodes.def Tue Feb 10 14:06:48 2009
> @@ -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)
>
> Modified: cfe/trunk/lib/AST/DeclSerialization.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclSerialization.cpp?rev=64231&r1=64230&r2=64231&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/AST/DeclSerialization.cpp (original)
> +++ cfe/trunk/lib/AST/DeclSerialization.cpp Tue Feb 10 14:06:48 2009
> @@ -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;
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list