aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaCodeComplete.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-01-30 06:58:39 +0000
committerDouglas Gregor <dgregor@apple.com>2013-01-30 06:58:39 +0000
commit5824b803bb964247d2633ae893af409f915c80b1 (patch)
tree6d512aed2b03d2ce02f37e6436866841f3f194fa /lib/Sema/SemaCodeComplete.cpp
parent48cb74adac0acb5681ba12e9202adc1d9cb2d523 (diff)
The instance methods of the root class of an Objective-C hieararchy
can be messaged via the metaclass. Provide code completions for this case. Fixes <rdar://problem/12560296>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r--lib/Sema/SemaCodeComplete.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp
index ce580ceea3..48d1b61cd3 100644
--- a/lib/Sema/SemaCodeComplete.cpp
+++ b/lib/Sema/SemaCodeComplete.cpp
@@ -4769,10 +4769,15 @@ static void AddObjCMethods(ObjCContainerDecl *Container,
bool InOriginalClass = true) {
typedef CodeCompletionResult Result;
Container = getContainerDef(Container);
+ ObjCInterfaceDecl *IFace = dyn_cast<ObjCInterfaceDecl>(Container);
+ bool isRootClass = IFace && !IFace->getSuperClass();
for (ObjCContainerDecl::method_iterator M = Container->meth_begin(),
MEnd = Container->meth_end();
M != MEnd; ++M) {
- if (M->isInstanceMethod() == WantInstanceMethods) {
+ // The instance methods on the root class can be messaged via the
+ // metaclass.
+ if (M->isInstanceMethod() == WantInstanceMethods ||
+ (isRootClass && !WantInstanceMethods)) {
// Check whether the selector identifiers we've been given are a
// subset of the identifiers for this particular method.
if (!isAcceptableObjCMethod(*M, WantKind, SelIdents, NumSelIdents,
@@ -4805,7 +4810,6 @@ static void AddObjCMethods(ObjCContainerDecl *Container,
}
}
- ObjCInterfaceDecl *IFace = dyn_cast<ObjCInterfaceDecl>(Container);
if (!IFace || !IFace->hasDefinition())
return;