Add "instancetype" as a code completion result for the return type of

an Objective-C method. Fixes <rdar://problem/13069990>.

llvm-svn: 173905
This commit is contained in:
Douglas Gregor 2013-01-30 07:11:43 +00:00
parent a6f00fe083
commit ed1f59701e
2 changed files with 16 additions and 0 deletions

View File

@ -4966,6 +4966,11 @@ void Sema::CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS,
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);

View File

@ -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)