[cfe-commits] r114079 - in /cfe/trunk: lib/Sema/SemaCodeComplete.cpp test/Index/complete-objc-message-id.m
Douglas Gregor
dgregor at apple.com
Thu Sep 16 08:34:59 PDT 2010
Author: dgregor
Date: Thu Sep 16 10:34:59 2010
New Revision: 114079
URL: http://llvm.org/viewvc/llvm-project?rev=114079&view=rev
Log:
When collecting Objective-C methods for message send completions, be
sure to visit the protocols of protocols.
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/Index/complete-objc-message-id.m
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=114079&r1=114078&r2=114079&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Thu Sep 16 10:34:59 2010
@@ -3869,6 +3869,17 @@
}
}
+ // Visit the protocols of protocols.
+ if (ObjCProtocolDecl *Protocol = dyn_cast<ObjCProtocolDecl>(Container)) {
+ const ObjCList<ObjCProtocolDecl> &Protocols
+ = Protocol->getReferencedProtocols();
+ for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
+ E = Protocols.end();
+ I != E; ++I)
+ AddObjCMethods(*I, WantInstanceMethods, WantKind, SelIdents, NumSelIdents,
+ CurContext, Results, false);
+ }
+
ObjCInterfaceDecl *IFace = dyn_cast<ObjCInterfaceDecl>(Container);
if (!IFace)
return;
Modified: cfe/trunk/test/Index/complete-objc-message-id.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-objc-message-id.m?rev=114079&r1=114078&r2=114079&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-objc-message-id.m (original)
+++ cfe/trunk/test/Index/complete-objc-message-id.m Thu Sep 16 10:34:59 2010
@@ -31,6 +31,22 @@
return [A alloc];
}
@end
+
+ at protocol P1
+- (int)P1_method1;
++ (int)P1_method2;
+ at end
+
+ at protocol P2 <P1>
+- (int)P2_method1;
++ (int)P2_method2;
+ at end
+
+void message_qualified_id(id<P2> ip2) {
+ [ip2 P1_method];
+ ip2 P1_method];
+}
+
// RUN: c-index-test -code-completion-at=%s:24:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: ObjCInstanceMethodDecl:{ResultType id}{TypedText autorelease}
// CHECK-CC1-NOT: B_method
@@ -52,3 +68,7 @@
// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType id}{TypedText new} (20)
// CHECK-SELECTOR-PREF: ObjCClassMethodDecl:{ResultType Class}{TypedText superclass} (20)
+// RUN: c-index-test -code-completion-at=%s:46:7 %s | FileCheck -check-prefix=CHECK-INSTANCE-QUAL-ID %s
+// RUN: c-index-test -code-completion-at=%s:47:7 %s | FileCheck -check-prefix=CHECK-INSTANCE-QUAL-ID %s
+// CHECK-INSTANCE-QUAL-ID: ObjCInstanceMethodDecl:{ResultType int}{TypedText P1_method1} (22)
+// CHECK-INSTANCE-QUAL-ID: ObjCInstanceMethodDecl:{ResultType int}{TypedText P2_method1} (20)
More information about the cfe-commits
mailing list