diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-25 00:59:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-25 00:59:09 +0000 |
commit | 0d266d623452f09d06973528217390d762a8f3fa (patch) | |
tree | 3a910f774eaf4633c424b704c66781a1f7938cc7 /lib/Sema/SemaDeclObjC.cpp | |
parent | 43d1251a471d19ce83aa8ce91c0104addada5add (diff) |
Whenever Sema attempts to look in the global method pool, try to load
additional data from the external Sema source. This properly copes
with modules that are imported after we have already searched in the
global method pool for a given selector. For PCH, it's a slight
pessimization to be fixed soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 432e3ddf54..4394dbf9be 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1983,17 +1983,13 @@ void Sema::ReadMethodPool(Selector Sel) { void Sema::AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance) { + if (ExternalSource) + ReadMethodPool(Method->getSelector()); + GlobalMethodPool::iterator Pos = MethodPool.find(Method->getSelector()); - if (Pos == MethodPool.end()) { - if (ExternalSource) { - ReadMethodPool(Method->getSelector()); - Pos = MethodPool.find(Method->getSelector()); - } - - if (Pos == MethodPool.end()) - Pos = MethodPool.insert(std::make_pair(Method->getSelector(), - GlobalMethods())).first; - } + if (Pos == MethodPool.end()) + Pos = MethodPool.insert(std::make_pair(Method->getSelector(), + GlobalMethods())).first; Method->setDefined(impl); @@ -2023,18 +2019,12 @@ static bool isAcceptableMethodMismatch(ObjCMethodDecl *chosen, ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass, bool warn, bool instance) { + if (ExternalSource) + ReadMethodPool(Sel); + GlobalMethodPool::iterator Pos = MethodPool.find(Sel); - if (Pos == MethodPool.end()) { - if (ExternalSource) { - ReadMethodPool(Sel); - - Pos = MethodPool.find(Sel); - if (Pos == MethodPool.end()) - return 0; - - } else - return 0; - } + if (Pos == MethodPool.end()) + return 0; ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second; |