From de7b4cd12d0d1d3bb781a6633c46131747c8dc27 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 13 Dec 2007 00:54:18 +0000 Subject: [PATCH] Moved ObjcDeclQualifier to ParmVarDecl from VarDecl. Ted, this change necessitates (de)/serialization of ParmVarDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44972 91177308-0d34-0410-b5e6-96231b3b80d8 --- AST/DeclSerialization.cpp | 8 +++++--- include/clang/AST/Decl.h | 24 +++++++++++++----------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/AST/DeclSerialization.cpp b/AST/DeclSerialization.cpp index 16654bbe66..f2ed75b4b5 100644 --- a/AST/DeclSerialization.cpp +++ b/AST/DeclSerialization.cpp @@ -146,13 +146,15 @@ void ValueDecl::ReadInRec(Deserializer& D) { void VarDecl::EmitInRec(Serializer& S) const { ValueDecl::EmitInRec(S); S.EmitInt(getStorageClass()); // From VarDecl. - S.EmitInt(getObjcDeclQualifier()); // From VarDecl. + // FIXME: This is now in ParmVarDecl + // S.EmitInt(getObjcDeclQualifier()); // From VarDecl. } void VarDecl::ReadInRec(Deserializer& D) { ValueDecl::ReadInRec(D); - SClass = static_cast(D.ReadInt()); // From VarDecl. - objcDeclQualifier = static_cast(D.ReadInt()); // VarDecl. + SClass = static_cast(D.ReadInt()); // From VarDecl. + // FIXME: This is now in ParmVarDecl + // objcDeclQualifier = static_cast(D.ReadInt()); // VarDecl. } //===------------------------------------------------------------===// diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index a1bb625dda..8fd68295fb 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -319,10 +319,6 @@ public: // as static variables declared within a function. bool hasGlobalStorage() const { return !hasAutoStorage(); } - ObjcDeclQualifier getObjcDeclQualifier() const { return objcDeclQualifier; } - void setObjcDeclQualifier(ObjcDeclQualifier QTVal) - { objcDeclQualifier = QTVal; } - // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return D->getKind() >= VarFirst && D->getKind() <= VarLast; @@ -331,16 +327,12 @@ public: protected: VarDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass SC, ScopedDecl *PrevDecl, AttributeList *A = 0) - : ValueDecl(DK, L, Id, T, PrevDecl, A), Init(0), - objcDeclQualifier(OBJC_TQ_None) { SClass = SC; } + : ValueDecl(DK, L, Id, T, PrevDecl, A), Init(0) { SClass = SC; } private: Expr *Init; // FIXME: This can be packed into the bitfields in Decl. unsigned SClass : 3; - /// FIXME: Also can be paced into the bitfields in Decl. - /// in, inout, etc. - ObjcDeclQualifier objcDeclQualifier : 6; - + friend class StmtIteratorBase; protected: @@ -401,12 +393,22 @@ class ParmVarDecl : public VarDecl { public: ParmVarDecl(SourceLocation L, IdentifierInfo *Id, QualType T, StorageClass S, ScopedDecl *PrevDecl, AttributeList *A = 0) - : VarDecl(ParmVar, L, Id, T, S, PrevDecl, A) {} + : VarDecl(ParmVar, L, Id, T, S, PrevDecl, A), + objcDeclQualifier(OBJC_TQ_None) {} + ObjcDeclQualifier getObjcDeclQualifier() const { return objcDeclQualifier; } + void setObjcDeclQualifier(ObjcDeclQualifier QTVal) + { objcDeclQualifier = QTVal; } + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return D->getKind() == ParmVar; } static bool classof(const ParmVarDecl *D) { return true; } +private: + /// FIXME: Also can be paced into the bitfields in Decl. + /// in, inout, etc. + ObjcDeclQualifier objcDeclQualifier : 6; + protected: /// CreateImpl - Deserialize a ParmVarDecl. Called by Decl::Create. static ParmVarDecl* CreateImpl(llvm::Deserializer& D); -- 2.50.1