r173905 - Add "instancetype" as a code completion result for the return type of
Douglas Gregor
dgregor at apple.com
Tue Jan 29 23:11:44 PST 2013
Author: dgregor
Date: Wed Jan 30 01:11:43 2013
New Revision: 173905
URL: http://llvm.org/viewvc/llvm-project?rev=173905&view=rev
Log:
Add "instancetype" as a code completion result for the return type of
an Objective-C method. Fixes <rdar://problem/13069990>.
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/Index/complete-declarators.m
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=173905&r1=173904&r2=173905&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Wed Jan 30 01:11:43 2013
@@ -4966,6 +4966,11 @@ void Sema::CodeCompleteObjCPassingType(S
Builder.AddTextChunk("sender");
Results.AddResult(CodeCompletionResult(Builder.TakeString()));
}
+
+ // If we're completing the return type, provide 'instancetype'.
+ if (!IsParameter) {
+ Results.AddResult(CodeCompletionResult("instancetype"));
+ }
// Add various builtin type names and specifiers.
AddOrdinaryNameResults(PCC_Type, S, *this, Results);
Modified: cfe/trunk/test/Index/complete-declarators.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-declarators.m?rev=173905&r1=173904&r2=173905&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-declarators.m (original)
+++ cfe/trunk/test/Index/complete-declarators.m Wed Jan 30 01:11:43 2013
@@ -24,6 +24,17 @@
}
@end
+// RUN: c-index-test -code-completion-at=%s:7:4 %s | FileCheck -check-prefix=CHECK-CC0 %s
+// CHECK-CC0: NotImplemented:{TypedText IBAction}{RightParen )}{Placeholder selector}{Colon :}{LeftParen (}{Text id}{RightParen )}{Text sender} (40)
+// CHECK-CC0: macro definition:{TypedText IBAction} (70)
+// CHECK-CC0: macro definition:{TypedText IBOutlet} (70)
+// CHECK-CC0: macro definition:{TypedText IBOutletCollection}{LeftParen (}{Placeholder ClassName}{RightParen )} (70)
+// CHECK-CC0: TypedefDecl:{TypedText id} (50)
+// CHECK-CC0: NotImplemented:{TypedText in} (40)
+// CHECK-CC0: NotImplemented:{TypedText inout} (40)
+// CHECK-CC0: NotImplemented:{TypedText instancetype} (40)
+// CHECK-CC0: NotImplemented:{TypedText int} (50)
+// CHECK-CC0: NotImplemented:{TypedText long} (50)
// RUN: c-index-test -code-completion-at=%s:7:19 %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1-NOT: NotImplemented:{TypedText extern} (40)
// CHECK-CC1: NotImplemented:{TypedText param1} (40)
More information about the cfe-commits
mailing list