[code-completion] Strip outer nullability annotations when completing method implementations.

The outer nullability is transferred from the declaration to the implementation so including them is redundant.
The inner ones are not transferred so they are kept to match the exact types. When we transfer the inner ones as well
adding them in the implementation will become redundant and we should strip those as well.

rdar://21737451

llvm-svn: 243119
This commit is contained in:
Argyrios Kyrtzidis
2015-07-24 17:00:19 +00:00
parent fceca9b539
commit f0917ab7c1
3 changed files with 14 additions and 9 deletions

View File

@@ -7079,11 +7079,13 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S,
// If the result type was not already provided, add it to the
// pattern as (type).
if (ReturnType.isNull())
AddObjCPassingTypeChunk(Method->getSendResultType()
.stripObjCKindOfType(Context),
if (ReturnType.isNull()) {
QualType ResTy = Method->getSendResultType().stripObjCKindOfType(Context);
AttributedType::stripOuterNullability(ResTy);
AddObjCPassingTypeChunk(ResTy,
Method->getObjCDeclQualifier(), Context, Policy,
Builder);
}
Selector Sel = Method->getSelector();
@@ -7114,6 +7116,7 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S,
ParamType = (*P)->getOriginalType();
ParamType = ParamType.substObjCTypeArgs(Context, {},
ObjCSubstitutionContext::Parameter);
AttributedType::stripOuterNullability(ParamType);
AddObjCPassingTypeChunk(ParamType,
(*P)->getObjCDeclQualifier(),
Context, Policy,