aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-16 00:51:18 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-16 00:51:18 +0000
commit78bcd9139f4b35be75190446c95614120d9b4c09 (patch)
tree47f6df400f9061d9048a68b4dc393c4515a3f4de /lib/Sema/SemaCodeComplete.cpp
parentc20e20498e3d248c754c7c5c8d0277f444d584df (diff)
When trying to provide a code completion item for a call to "super" in
Objective-C, also look in the categories and class extensions of our superclasses. Fixes <rdar://problem/8853540>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125628 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--lib/Sema/SemaCodeComplete.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index 3a07ef6783..d92b9fe71c 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -4478,10 +4478,21 @@ static ObjCMethodDecl *AddSuperSendCompletion(Sema &S, bool NeedSuperKeyword,
// Try to find a superclass method with the same selector.
ObjCMethodDecl *SuperMethod = 0;
- while ((Class = Class->getSuperClass()) && !SuperMethod)
+ while ((Class = Class->getSuperClass()) && !SuperMethod) {
+ // Check in the class
SuperMethod = Class->getMethod(CurMethod->getSelector(),
CurMethod->isInstanceMethod());
+ // Check in categories or class extensions.
+ if (!SuperMethod) {
+ for (ObjCCategoryDecl *Category = Class->getCategoryList(); Category;
+ Category = Category->getNextClassCategory())
+ if ((SuperMethod = Category->getMethod(CurMethod->getSelector(),
+ CurMethod->isInstanceMethod())))
+ break;
+ }
+ }
+
if (!SuperMethod)
return 0;