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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49855 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index 96df1b7..e7442ff 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -41,6 +41,9 @@
       assert (false && "Not implemented.");
       break;
 
+    case TranslationUnit:
+      return TranslationUnitDecl::CreateImpl(D, C);
+
     case Var:
       return VarDecl::CreateImpl(D, C);
       
@@ -192,6 +195,26 @@
 }
 
 //===----------------------------------------------------------------------===//
+//      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.
 //===----------------------------------------------------------------------===//