aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-08-04 17:20:04 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-08-04 17:20:04 +0000
commit5d05007b7a7883159154e3f65f338a2542d53913 (patch)
treed4a00d8fdbd3301a51adba342f8e15724279c217 /lib/Frontend/PCHReader.cpp
parentb75d3dfa4ca6531858b8132eb4db7260408671cf (diff)
Store the IDs of selectors in the PCH file explicitly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110219 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r--lib/Frontend/PCHReader.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 7d3a25f367..ac817ac050 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -471,7 +471,10 @@ class PCHMethodPoolLookupTrait {
PCHReader &Reader;
public:
- typedef std::pair<ObjCMethodList, ObjCMethodList> data_type;
+ struct data_type {
+ pch::SelectorID ID;
+ ObjCMethodList Instance, Factory;
+ };
typedef Selector external_key_type;
typedef external_key_type internal_key_type;
@@ -527,20 +530,22 @@ public:
data_type ReadData(Selector, const unsigned char* d, unsigned DataLen) {
using namespace clang::io;
- unsigned NumInstanceMethods = ReadUnalignedLE16(d);
- unsigned NumFactoryMethods = ReadUnalignedLE16(d);
data_type Result;
+ Result.ID = ReadUnalignedLE32(d);
+ unsigned NumInstanceMethods = ReadUnalignedLE16(d);
+ unsigned NumFactoryMethods = ReadUnalignedLE16(d);
+
// Load instance methods
ObjCMethodList *Prev = 0;
for (unsigned I = 0; I != NumInstanceMethods; ++I) {
ObjCMethodDecl *Method
= cast<ObjCMethodDecl>(Reader.GetDecl(ReadUnalignedLE32(d)));
- if (!Result.first.Method) {
+ if (!Result.Instance.Method) {
// This is the first method, which is the easy case.
- Result.first.Method = Method;
- Prev = &Result.first;
+ Result.Instance.Method = Method;
+ Prev = &Result.Instance;
continue;
}
@@ -555,10 +560,10 @@ public:
for (unsigned I = 0; I != NumFactoryMethods; ++I) {
ObjCMethodDecl *Method
= cast<ObjCMethodDecl>(Reader.GetDecl(ReadUnalignedLE32(d)));
- if (!Result.second.Method) {
+ if (!Result.Factory.Method) {
// This is the first method, which is the easy case.
- Result.second.Method = Method;
- Prev = &Result.second;
+ Result.Factory.Method = Method;
+ Prev = &Result.Factory;
continue;
}
@@ -3215,11 +3220,14 @@ PCHReader::ReadMethodPool(Selector Sel) {
PCHMethodPoolLookupTable::iterator Pos = PoolTable->find(Sel);
if (Pos == PoolTable->end()) {
++NumMethodPoolMisses;
- return std::pair<ObjCMethodList, ObjCMethodList>();;
+ return std::pair<ObjCMethodList, ObjCMethodList>();
}
++NumMethodPoolSelectorsRead;
- return *Pos;
+ PCHMethodPoolLookupTrait::data_type Data = *Pos;
+ if (DeserializationListener)
+ DeserializationListener->SelectorRead(Data.ID, Sel);
+ return std::make_pair(Data.Instance, Data.Factory);
}
void PCHReader::SetIdentifierInfo(unsigned ID, IdentifierInfo *II) {