forked from OSchip/llvm-project
Switch code-completion's ivar lookup over to LookupVisibleDecls,
eliminating yet one more ResultBuilder::MaybeAddResult caller. llvm-svn: 93430
This commit is contained in:
parent
78a210145b
commit
2b8162b7d0
|
@ -212,6 +212,7 @@ namespace {
|
||||||
bool IsNamespaceOrAlias(NamedDecl *ND) const;
|
bool IsNamespaceOrAlias(NamedDecl *ND) const;
|
||||||
bool IsType(NamedDecl *ND) const;
|
bool IsType(NamedDecl *ND) const;
|
||||||
bool IsMember(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);
|
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 {
|
namespace {
|
||||||
/// \brief Visible declaration consumer that adds a code-completion result
|
/// \brief Visible declaration consumer that adds a code-completion result
|
||||||
/// for each visible declaration.
|
/// for each visible declaration.
|
||||||
|
@ -2052,11 +2059,10 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, ExprTy *BaseE,
|
||||||
Class = BaseType->getAs<ObjCInterfaceType>()->getDecl();
|
Class = BaseType->getAs<ObjCInterfaceType>()->getDecl();
|
||||||
|
|
||||||
// Add all ivars from this class and its superclasses.
|
// Add all ivars from this class and its superclasses.
|
||||||
for (; Class; Class = Class->getSuperClass()) {
|
if (Class) {
|
||||||
for (ObjCInterfaceDecl::ivar_iterator IVar = Class->ivar_begin(),
|
CodeCompletionDeclConsumer Consumer(Results, CurContext);
|
||||||
IVarEnd = Class->ivar_end();
|
Results.setFilter(&ResultBuilder::IsObjCIvar);
|
||||||
IVar != IVarEnd; ++IVar)
|
LookupVisibleDecls(Class, LookupMemberName, Consumer);
|
||||||
Results.MaybeAddResult(Result(*IVar, 0), CurContext);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue