summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-14 16:08:12 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-14 16:08:12 +0000
commit2b8162b7d08b9326f479544d6bacbec951ed8af3 (patch)
treec6193e265fa98c8e439f892dfb139ed54aea160e /clang/lib/Sema/SemaCodeComplete.cpp
parent78a210145b559ee5b1e2c1f63b5e3692b8f5fd85 (diff)
downloadbcm5719-llvm-2b8162b7d08b9326f479544d6bacbec951ed8af3.tar.gz
bcm5719-llvm-2b8162b7d08b9326f479544d6bacbec951ed8af3.zip
Switch code-completion's ivar lookup over to LookupVisibleDecls,
eliminating yet one more ResultBuilder::MaybeAddResult caller. llvm-svn: 93430
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 46b538520bb..cf232d1f175 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/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);
}
}
OpenPOWER on IntegriCloud