summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-25 19:25:49 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-25 19:25:49 +0000
commitb3e5f7a7ff8703c547d9d36dac309a0424e1a041 (patch)
treeed52091cd76133ef5b58c1b43ba99ef2585726ba /clang/lib/Frontend/PCHWriter.cpp
parentb62db80c830b6fcf6219ad4157f3e92a864e438c (diff)
downloadbcm5719-llvm-b3e5f7a7ff8703c547d9d36dac309a0424e1a041.tar.gz
bcm5719-llvm-b3e5f7a7ff8703c547d9d36dac309a0424e1a041.zip
Tweak the data layout for the on-disk hash table of identifiers in the PCH file so that the key layout matches that of the PTH key layout
llvm-svn: 70066
Diffstat (limited to 'clang/lib/Frontend/PCHWriter.cpp')
-rw-r--r--clang/lib/Frontend/PCHWriter.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp
index 4ac836419eb..7eb398c1663 100644
--- a/clang/lib/Frontend/PCHWriter.cpp
+++ b/clang/lib/Frontend/PCHWriter.cpp
@@ -2013,7 +2013,6 @@ public:
EmitKeyDataLength(llvm::raw_ostream& Out, const IdentifierInfo* II,
pch::IdentID ID) {
unsigned KeyLen = strlen(II->getName()) + 1;
- clang::io::Emit16(Out, KeyLen);
unsigned DataLen = 4 + 4; // 4 bytes for token ID, builtin, flags
// 4 bytes for the persistent ID
if (II->hasMacroDefinition() &&
@@ -2023,7 +2022,14 @@ public:
DEnd = IdentifierResolver::end();
D != DEnd; ++D)
DataLen += sizeof(pch::DeclID);
+
+ // We emit the data length before the key length, because we want
+ // the key length to immediately precede the actual string
+ // data. This is so that our identifier length + key layout
+ // matches that of the identifier hash table for pretokenized
+ // headers.
clang::io::Emit16(Out, DataLen);
+ clang::io::Emit16(Out, KeyLen);
return std::make_pair(KeyLen, DataLen);
}
OpenPOWER on IntegriCloud