diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-04-17 14:40:12 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-04-17 14:40:12 +0000 |
commit | c3b69ae815298eeb29d849537ad229ba9bcf0f9c (patch) | |
tree | ea0f0f40e0c9174f8f0ad7d412e758bcab3eb364 /clang/lib/AST/DeclSerialization.cpp | |
parent | 3da1d68662e5f9796de1692ae69d6c5393842cf6 (diff) | |
download | bcm5719-llvm-c3b69ae815298eeb29d849537ad229ba9bcf0f9c.tar.gz bcm5719-llvm-c3b69ae815298eeb29d849537ad229ba9bcf0f9c.zip |
Addition of TranslationUnitDecl to the AST:
-Added TranslationUnitDecl class to serve as top declaration context
-ASTContext gets a TUDecl member and a getTranslationUnitDecl() function
-All ScopedDecls get the TUDecl as DeclContext when declared at global scope
llvm-svn: 49855
Diffstat (limited to 'clang/lib/AST/DeclSerialization.cpp')
-rw-r--r-- | clang/lib/AST/DeclSerialization.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclSerialization.cpp b/clang/lib/AST/DeclSerialization.cpp index 96df1b7fbf4..e7442ff51cc 100644 --- a/clang/lib/AST/DeclSerialization.cpp +++ b/clang/lib/AST/DeclSerialization.cpp @@ -41,6 +41,9 @@ Decl* Decl::Create(Deserializer& D, ASTContext& C) { assert (false && "Not implemented."); break; + case TranslationUnit: + return TranslationUnitDecl::CreateImpl(D, C); + case Var: return VarDecl::CreateImpl(D, C); @@ -192,6 +195,26 @@ void VarDecl::ReadImpl(Deserializer& D, ASTContext& C) { } //===----------------------------------------------------------------------===// +// TranslationUnitDecl Serialization. +//===----------------------------------------------------------------------===// + +void TranslationUnitDecl::EmitImpl(llvm::Serializer& S) const +{ + Decl::EmitInRec(S); +} + +TranslationUnitDecl* TranslationUnitDecl::CreateImpl(Deserializer& D, + ASTContext& C) { + void *Mem = C.getAllocator().Allocate<TranslationUnitDecl>(); + TranslationUnitDecl* decl = + new (Mem) TranslationUnitDecl(); + + decl->Decl::ReadInRec(D, C); + + return decl; +} + +//===----------------------------------------------------------------------===// // VarDecl Serialization. //===----------------------------------------------------------------------===// |