Moved LangOptions from TranslationUnit to ASTContext.  This induced a variety of cleanups in some ASTConsumers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51943 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index a87efa7..2fe1f51 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1701,6 +1701,7 @@
 
 /// Emit - Serialize an ASTContext object to Bitcode.
 void ASTContext::Emit(llvm::Serializer& S) const {
+  S.Emit(LangOpts);
   S.EmitRef(SourceMgr);
   S.EmitRef(Target);
   S.EmitRef(Idents);
@@ -1720,6 +1721,11 @@
 }
 
 ASTContext* ASTContext::Create(llvm::Deserializer& D) {
+  
+  // Read the language options.
+  LangOptions LOpts;
+  LOpts.Read(D);
+  
   SourceManager &SM = D.ReadRef<SourceManager>();
   TargetInfo &t = D.ReadRef<TargetInfo>();
   IdentifierTable &idents = D.ReadRef<IdentifierTable>();
@@ -1727,7 +1733,7 @@
 
   unsigned size_reserve = D.ReadInt();
   
-  ASTContext* A = new ASTContext(SM,t,idents,sels,size_reserve);
+  ASTContext* A = new ASTContext(LOpts, SM, t, idents, sels, size_reserve);
   
   for (unsigned i = 0; i < size_reserve; ++i)
     Type::Create(*A,i,D);
diff --git a/lib/AST/TranslationUnit.cpp b/lib/AST/TranslationUnit.cpp
index f1505b0..f8416f1 100644
--- a/lib/AST/TranslationUnit.cpp
+++ b/lib/AST/TranslationUnit.cpp
@@ -124,16 +124,13 @@
   
   Sezr.EnterBlock(BasicMetadataBlock);
   
-  // Block for SourceManager, LangOptions, and Target.  Allows easy skipping
+  // Block for SourceManager and Target.  Allows easy skipping
   // around to the block for the Selectors during deserialization.
   Sezr.EnterBlock();
     
   // Emit the SourceManager.
   Sezr.Emit(Context->getSourceManager());
-  
-  // Emit the LangOptions.
-  Sezr.Emit(LangOpts);
-  
+    
   // Emit the Target.
   Sezr.EmitPtr(&Context->Target);
   Sezr.EmitCStr(Context->Target.getTargetTriple());
@@ -211,10 +208,7 @@
   
   // Read the SourceManager.
   SourceManager::CreateAndRegister(Dezr,FMgr);
-  
-  // Read the LangOptions.
-  TU->LangOpts.Read(Dezr);
-  
+    
   { // Read the TargetInfo.
     llvm::SerializedPtrID PtrID = Dezr.ReadPtrID();
     char* triple = Dezr.ReadCStr(NULL,0,true);