[cfe-commits] r64304 - in /cfe/trunk: Driver/CacheTokens.cpp include/clang/Lex/PTHManager.h lib/Lex/PTHLexer.cpp
Ted Kremenek
kremenek at apple.com
Wed Feb 11 08:06:56 PST 2009
Author: kremenek
Date: Wed Feb 11 10:06:55 2009
New Revision: 64304
URL: http://llvm.org/viewvc/llvm-project?rev=64304&view=rev
Log:
PTH: Don't emit the PTH offset of the IdentifierInfo string data as that data is
referenced by other tables.
Modified:
cfe/trunk/Driver/CacheTokens.cpp
cfe/trunk/include/clang/Lex/PTHManager.h
cfe/trunk/lib/Lex/PTHLexer.cpp
Modified: cfe/trunk/Driver/CacheTokens.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/CacheTokens.cpp?rev=64304&r1=64303&r2=64304&view=diff
==============================================================================
--- cfe/trunk/Driver/CacheTokens.cpp (original)
+++ cfe/trunk/Driver/CacheTokens.cpp Wed Feb 11 10:06:55 2009
@@ -273,8 +273,12 @@
for ( ; I != E ; ++I) Out << *I;
}
- std::pair<Offset,std::pair<Offset, Offset> > EmitIdentifierTable();
- Offset EmitFileTable();
+ std::pair<Offset, Offset> EmitIdentifierTable();
+
+ /// EmitFileTable - Emit a table mapping from file name strings to PTH
+ /// token data.
+ Offset EmitFileTable() { return PM.Emit(Out); }
+
PCHEntry LexTokens(Lexer& L);
Offset EmitCachedSpellings();
@@ -361,8 +365,7 @@
};
}
-std::pair<Offset,std::pair<Offset,Offset> >
-PTHWriter::EmitIdentifierTable() {
+std::pair<Offset,Offset> PTHWriter::EmitIdentifierTable() {
llvm::BumpPtrAllocator Alloc;
// Build an inverse map from persistent IDs -> IdentifierInfo*.
@@ -388,9 +391,6 @@
Offset LexicalOff = Out.tell();
for (unsigned i = 0; i < idcount ; ++i) Emit32(LexicalOrder[i]);
- // Write out the string data itself.
- Offset DataOff = Out.tell();
-
for (unsigned i = 0; i < idcount; ++i) {
IDData& d = IIDMap[i];
d.FileOffset = Out.tell(); // Record the location for this data.
@@ -408,7 +408,7 @@
Emit32(idcount); // Emit the number of identifiers.
for (unsigned i = 0 ; i < idcount; ++i) Emit32(IIDMap[i].FileOffset);
- return std::make_pair(DataOff, std::make_pair(IDOff, LexicalOff));
+ return std::make_pair(IDOff, LexicalOff);
}
@@ -616,8 +616,7 @@
}
// Write out the identifier table.
- const std::pair<Offset, std::pair<Offset,Offset> >& IdTableOff
- = EmitIdentifierTable();
+ const std::pair<Offset,Offset>& IdTableOff = EmitIdentifierTable();
// Write out the cached strings table.
Offset SpellingOff = EmitCachedSpellings();
@@ -628,8 +627,7 @@
// 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(IdTableOff.second);
Emit32(FileTableOff);
Emit32(SpellingOff);
@@ -659,11 +657,3 @@
PW.GeneratePTH();
}
-
-//===----------------------------------------------------------------------===//
-// Client code of on-disk hashtable logic.
-//===----------------------------------------------------------------------===//
-
-Offset PTHWriter::EmitFileTable() {
- return PM.Emit(Out);
-}
Modified: cfe/trunk/include/clang/Lex/PTHManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PTHManager.h?rev=64304&r1=64303&r2=64304&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/PTHManager.h (original)
+++ cfe/trunk/include/clang/Lex/PTHManager.h Wed Feb 11 10:06:55 2009
@@ -96,7 +96,7 @@
public:
// The current PTH version.
- enum { Version = 2 };
+ enum { Version = 3 };
~PTHManager();
Modified: cfe/trunk/lib/Lex/PTHLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PTHLexer.cpp?rev=64304&r1=64303&r2=64304&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PTHLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PTHLexer.cpp Wed Feb 11 10:06:55 2009
@@ -551,7 +551,7 @@
// Construct the file lookup table. This will be used for mapping from
// FileEntry*'s to cached tokens.
- const unsigned char* FileTableOffset = EndTable + sizeof(uint32_t)*3;
+ const unsigned char* FileTableOffset = EndTable + sizeof(uint32_t)*2;
const unsigned char* FileTable = BufBeg + ReadLE32(FileTableOffset);
if (!(FileTable > BufBeg && FileTable < BufEnd)) {
@@ -567,7 +567,7 @@
// Get the location of the table mapping from persistent ids to the
// data needed to reconstruct identifiers.
- const unsigned char* IDTableOffset = EndTable + sizeof(uint32_t)*1;
+ const unsigned char* IDTableOffset = EndTable + sizeof(uint32_t)*0;
const unsigned char* IData = BufBeg + ReadLE32(IDTableOffset);
if (!(IData >= BufBeg && IData < BufEnd)) {
@@ -576,7 +576,7 @@
}
// Get the location of the lexigraphically-sorted table of persistent IDs.
- const unsigned char* SortedIdTableOffset = EndTable + sizeof(uint32_t)*2;
+ const unsigned char* SortedIdTableOffset = EndTable + sizeof(uint32_t)*1;
const unsigned char* SortedIdTable = BufBeg + ReadLE32(SortedIdTableOffset);
if (!(SortedIdTable >= BufBeg && SortedIdTable < BufEnd)) {
InvalidPTH(Diags);
@@ -584,7 +584,7 @@
}
// Get the location of the spelling cache.
- const unsigned char* spellingBaseOffset = EndTable + sizeof(uint32_t)*4;
+ const unsigned char* spellingBaseOffset = EndTable + sizeof(uint32_t)*3;
const unsigned char* spellingBase = BufBeg + ReadLE32(spellingBaseOffset);
if (!(spellingBase >= BufBeg && spellingBase < BufEnd)) {
InvalidPTH(Diags);
More information about the cfe-commits
mailing list