Removed storing inode and device number in TranslationUnit.

Added "SourceFile" string to TranslationUnit to record corresponding
source file.

Updated serialization of TranslationUnits and logic in the driver to
correctly pass the source file information to the serializer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45211 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/TranslationUnit.cpp b/AST/TranslationUnit.cpp
index 7cf398b..41d9c79 100644
--- a/AST/TranslationUnit.cpp
+++ b/AST/TranslationUnit.cpp
@@ -24,14 +24,13 @@
 
 #include <stdio.h>
 
-namespace {
-  enum { BasicMetadataBlock = 1,
-         ASTContextBlock = 2,
-         DeclsBlock = 3 };
-}
-
 using namespace clang;
 
+enum { BasicMetadataBlock = 1,
+       ASTContextBlock = 2,
+       DeclsBlock = 3 };
+
+
 bool clang::EmitASTBitcodeFile(const TranslationUnit& TU, 
                                const llvm::sys::Path& Filename) {  
 
@@ -101,6 +100,10 @@
   // around to the block for the Selectors during deserialization.
   Sezr.EnterBlock();
   
+  // Emit the name of the source file.
+  Sezr.EmitCStr(SourceFile.c_str());
+  Sezr.FlushRecord();
+  
   // Emit the SourceManager.
   Sezr.Emit(Context->getSourceManager());
   
@@ -182,6 +185,12 @@
   
   FoundBlock = Dezr.SkipToBlock(BasicMetadataBlock);
   assert (FoundBlock);
+  
+  { // Read the SourceFile.
+    char* SName = Dezr.ReadCStr(NULL,0,true);
+    TU->SourceFile = SName;
+    delete [] SName;
+  }
 
   // Read the SourceManager.
   SourceManager::CreateAndRegister(Dezr,FMgr);