Switch code-completion's ivar lookup over to LookupVisibleDecls,

eliminating yet one more ResultBuilder::MaybeAddResult caller.

llvm-svn: 93430
This commit is contained in:
Douglas Gregor 2010-01-14 16:08:12 +00:00
parent 78a210145b
commit 2b8162b7d0
1 changed files with 11 additions and 5 deletions

View File

@ -212,6 +212,7 @@ namespace {
bool IsNamespaceOrAlias(NamedDecl *ND) const;
bool IsType(NamedDecl *ND) const;
bool IsMember(NamedDecl *ND) const;
bool IsObjCIvar(NamedDecl *ND) const;
//@}
};
}
@ -712,6 +713,12 @@ bool ResultBuilder::IsMember(NamedDecl *ND) const {
isa<ObjCPropertyDecl>(ND);
}
/// \rief Determines whether the given declaration is an Objective-C
/// instance variable.
bool ResultBuilder::IsObjCIvar(NamedDecl *ND) const {
return isa<ObjCIvarDecl>(ND);
}
namespace {
/// \brief Visible declaration consumer that adds a code-completion result
/// for each visible declaration.
@ -2052,11 +2059,10 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, ExprTy *BaseE,
Class = BaseType->getAs<ObjCInterfaceType>()->getDecl();
// Add all ivars from this class and its superclasses.
for (; Class; Class = Class->getSuperClass()) {
for (ObjCInterfaceDecl::ivar_iterator IVar = Class->ivar_begin(),
IVarEnd = Class->ivar_end();
IVar != IVarEnd; ++IVar)
Results.MaybeAddResult(Result(*IVar, 0), CurContext);
if (Class) {
CodeCompletionDeclConsumer Consumer(Results, CurContext);
Results.setFilter(&ResultBuilder::IsObjCIvar);
LookupVisibleDecls(Class, LookupMemberName, Consumer);
}
}