diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-14 16:08:12 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-14 16:08:12 +0000 |
commit | 80f4f4ce5a4c1416492ca6835cc85bb7e538ffc9 (patch) | |
tree | 6241dd083d9ba1c3da2984af431e04dd41ed21e0 /lib/Sema/SemaCodeComplete.cpp | |
parent | a4477810e45b2d203ffc960615d130137d2e6449 (diff) |
Switch code-completion's ivar lookup over to LookupVisibleDecls,
eliminating yet one more ResultBuilder::MaybeAddResult caller.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 46b538520b..cf232d1f17 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -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); } } |