aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-08-02 23:18:59 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-08-02 23:18:59 +0000
commitdb9d2145f1d85f64dba2c9b92416621ce01090a6 (patch)
tree39357e18129698727f20fbaff48fb840adf8f15d /lib/Sema/SemaCodeComplete.cpp
parentf8dcf1a1d3c4f28fc96a45d7159e1a9c95484632 (diff)
Simplify global method pool implementation in Sema. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--lib/Sema/SemaCodeComplete.cpp55
1 files changed, 24 insertions, 31 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index bc0335556f..476c79cc37 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -3547,20 +3547,18 @@ void Sema::CodeCompleteObjCClassMessage(Scope *S, TypeTy *Receiver,
for (uint32_t I = 0, N = ExternalSource->GetNumExternalSelectors();
I != N; ++I) {
Selector Sel = ExternalSource->GetExternalSelector(I);
- if (Sel.isNull() || FactoryMethodPool.count(Sel) ||
- InstanceMethodPool.count(Sel))
+ if (Sel.isNull() || MethodPool.count(Sel))
continue;
- ReadMethodPool(Sel, /*isInstance=*/false);
+ ReadMethodPool(Sel);
}
}
- for (llvm::DenseMap<Selector, ObjCMethodList>::iterator
- M = FactoryMethodPool.begin(),
- MEnd = FactoryMethodPool.end();
- M != MEnd;
- ++M) {
- for (ObjCMethodList *MethList = &M->second; MethList && MethList->Method;
+ for (GlobalMethodPool::iterator M = MethodPool.begin(),
+ MEnd = MethodPool.end();
+ M != MEnd; ++M) {
+ for (ObjCMethodList *MethList = &M->second.second;
+ MethList && MethList->Method;
MethList = MethList->Next) {
if (!isAcceptableObjCMethod(MethList->Method, MK_Any, SelIdents,
NumSelIdents))
@@ -3648,20 +3646,18 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver,
for (uint32_t I = 0, N = ExternalSource->GetNumExternalSelectors();
I != N; ++I) {
Selector Sel = ExternalSource->GetExternalSelector(I);
- if (Sel.isNull() || InstanceMethodPool.count(Sel) ||
- FactoryMethodPool.count(Sel))
+ if (Sel.isNull() || MethodPool.count(Sel))
continue;
- ReadMethodPool(Sel, /*isInstance=*/true);
+ ReadMethodPool(Sel);
}
}
- for (llvm::DenseMap<Selector, ObjCMethodList>::iterator
- M = InstanceMethodPool.begin(),
- MEnd = InstanceMethodPool.end();
- M != MEnd;
- ++M) {
- for (ObjCMethodList *MethList = &M->second; MethList && MethList->Method;
+ for (GlobalMethodPool::iterator M = MethodPool.begin(),
+ MEnd = MethodPool.end();
+ M != MEnd; ++M) {
+ for (ObjCMethodList *MethList = &M->second.first;
+ MethList && MethList->Method;
MethList = MethList->Next) {
if (!isAcceptableObjCMethod(MethList->Method, MK_Any, SelIdents,
NumSelIdents))
@@ -4174,20 +4170,16 @@ void Sema::CodeCompleteObjCMethodDeclSelector(Scope *S,
TypeTy *ReturnTy,
IdentifierInfo **SelIdents,
unsigned NumSelIdents) {
- llvm::DenseMap<Selector, ObjCMethodList> &Pool
- = IsInstanceMethod? InstanceMethodPool : FactoryMethodPool;
-
// If we have an external source, load the entire class method
// pool from the PCH file.
if (ExternalSource) {
for (uint32_t I = 0, N = ExternalSource->GetNumExternalSelectors();
I != N; ++I) {
Selector Sel = ExternalSource->GetExternalSelector(I);
- if (Sel.isNull() || InstanceMethodPool.count(Sel) ||
- FactoryMethodPool.count(Sel))
+ if (Sel.isNull() || MethodPool.count(Sel))
continue;
-
- ReadMethodPool(Sel, IsInstanceMethod);
+
+ ReadMethodPool(Sel);
}
}
@@ -4197,13 +4189,14 @@ void Sema::CodeCompleteObjCMethodDeclSelector(Scope *S,
if (ReturnTy)
Results.setPreferredType(GetTypeFromParser(ReturnTy).getNonReferenceType());
-
+
Results.EnterNewScope();
- for (llvm::DenseMap<Selector, ObjCMethodList>::iterator M = Pool.begin(),
- MEnd = Pool.end();
- M != MEnd;
- ++M) {
- for (ObjCMethodList *MethList = &M->second; MethList && MethList->Method;
+ for (GlobalMethodPool::iterator M = MethodPool.begin(),
+ MEnd = MethodPool.end();
+ M != MEnd; ++M) {
+ for (ObjCMethodList *MethList = IsInstanceMethod ? &M->second.first :
+ &M->second.second;
+ MethList && MethList->Method;
MethList = MethList->Next) {
if (!isAcceptableObjCMethod(MethList->Method, MK_Any, SelIdents,
NumSelIdents))