Embed the offset of the PTH table inside the prologue of the PTH file.  This will help improve gradual versioning of PTH files instead of relying that the PTH table is at a fixed offset.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63045 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/CacheTokens.cpp b/Driver/CacheTokens.cpp
index fcb4d2f..975d364 100644
--- a/Driver/CacheTokens.cpp
+++ b/Driver/CacheTokens.cpp
@@ -454,6 +454,11 @@
 }
 
 void PTHWriter::GeneratePTH() {
+  // Generate the prologue.
+  Out << "cfe-pth";
+  Offset JumpOffset = Out.tell();
+  Emit32(0);
+  
   // Iterate over all the files in SourceManager.  Create a lexer
   // for each file and cache the tokens.
   SourceManager &SM = PP.getSourceManager();
@@ -490,10 +495,15 @@
   Offset FileTableOff = EmitFileTable();  
   
   // Finally, write out the offset table at the end.
+  Offset JumpTargetOffset = Out.tell();    
   Emit32(IdTableOff.first);
   Emit32(IdTableOff.second.first);
   Emit32(IdTableOff.second.second);
   Emit32(FileTableOff);
+  
+  // Now write the offset in the prologue.
+  Out.seek(JumpOffset);
+  Emit32(JumpTargetOffset);
 }
 
 void clang::CacheTokens(Preprocessor& PP, const std::string& OutFile) {