aboutsummaryrefslogtreecommitdiff
path: root/Driver/CacheTokens.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-01-26 21:43:14 +0000
committerTed Kremenek <kremenek@apple.com>2009-01-26 21:43:14 +0000
commite1b6498c41b94c3bc5cede17b0702282543385ef (patch)
treed1d13ffdcf5f49a4c5cdff5c64513aadb055e8fc /Driver/CacheTokens.cpp
parent493dab7fe59303d8bb2120bc2556f355344f65bd (diff)
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
Diffstat (limited to 'Driver/CacheTokens.cpp')
-rw-r--r--Driver/CacheTokens.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Driver/CacheTokens.cpp b/Driver/CacheTokens.cpp
index fcb4d2f12d..975d3648ee 100644
--- a/Driver/CacheTokens.cpp
+++ b/Driver/CacheTokens.cpp
@@ -454,6 +454,11 @@ void PTHWriter::EmitCachedSpellings() {
}
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 @@ void PTHWriter::GeneratePTH() {
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) {