diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-11-14 17:47:01 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-11-14 17:47:01 +0000 |
commit | f9d56c8be593e539098df95b636469104f2967a4 (patch) | |
tree | 3236bc2ba0fdfdc5a1f944628e21ad30c5e6616d | |
parent | b899ad2265d3cba28edc74a7ade89c33cf8fdeab (diff) |
Implemented serialization of FieldDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44126 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | AST/DeclSerialization.cpp | 21 | ||||
-rw-r--r-- | include/clang/AST/Decl.h | 9 |
2 files changed, 30 insertions, 0 deletions
diff --git a/AST/DeclSerialization.cpp b/AST/DeclSerialization.cpp index cfab8cc76d..3e2ce0fcc8 100644 --- a/AST/DeclSerialization.cpp +++ b/AST/DeclSerialization.cpp @@ -43,6 +43,9 @@ Decl* Decl::Create(Deserializer& D) { case BlockVar: return BlockVarDecl::CreateImpl(D); + case Field: + return FieldDecl::CreateImpl(D); + case FileVar: return FileVarDecl::CreateImpl(D); @@ -217,6 +220,24 @@ ParmVarDecl* ParmVarDecl::CreateImpl(Deserializer& D) { } //===----------------------------------------------------------------------===// +// FieldDecl Serialization. +//===----------------------------------------------------------------------===// + +void FieldDecl::EmitImpl(Serializer& S) const { + S.Emit(getType()); + NamedDecl::EmitInRec(S); + S.EmitOwnedPtr(BitWidth); +} + +FieldDecl* FieldDecl::CreateImpl(Deserializer& D) { + QualType DeclType = QualType::ReadVal(D); + FieldDecl* decl = new FieldDecl(SourceLocation(),NULL,DeclType); + decl->ReadInRec(D); + decl->BitWidth = D.ReadOwnedPtr<Expr>(); + return decl; +} + +//===----------------------------------------------------------------------===// // FunctionDecl Serialization. //===----------------------------------------------------------------------===// diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 0ffb3277dd..5930d96711 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -505,6 +505,15 @@ public: return D->getKind() >= FieldFirst && D->getKind() <= FieldLast; } static bool classof(const FieldDecl *D) { return true; } + +protected: + /// EmitImpl - Serialize this FieldDecl. Called by Decl::Emit. + virtual void EmitImpl(llvm::Serializer& S) const; + + /// CreateImpl - Deserialize a FieldDecl. Called by Decl::Create. + static FieldDecl* CreateImpl(llvm::Deserializer& D); + + friend Decl* Decl::Create(llvm::Deserializer& D); }; /// EnumConstantDecl - An instance of this object exists for each enum constant |