[ObjC] Don't disallow vector parameters/return values in methods

whose introduced version is lower than the allowed version.

We should just rely on the target version as this introduced version can lead
to false positives (e.g. deprecated declarations).

rdar://31964333


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302250 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz 2017-05-05 16:15:17 +00:00
parent dc1f3e5a2b
commit e9b6eb5833
2 changed files with 3 additions and 12 deletions

View File

@ -4347,10 +4347,8 @@ static void checkObjCMethodX86VectorTypes(Sema &SemaRef,
AcceptedInVersion = VersionTuple(/*Major=*/10, /*Minor=*/11);
else
return;
VersionTuple MethodVersion = Method->getVersionIntroduced();
if (SemaRef.getASTContext().getTargetInfo().getPlatformMinVersion() >=
AcceptedInVersion &&
(MethodVersion.empty() || MethodVersion >= AcceptedInVersion))
AcceptedInVersion)
return;
SemaRef.Diag(Loc, diag::err_objc_method_unsupported_param_ret_type)
<< T << (Method->getReturnType()->isVectorType() ? /*return value*/ 1

View File

@ -68,6 +68,8 @@ struct AggregateFloat { float v; };
#else
// expected-no-diagnostics
-(void)takeVector:(float3)v {
}
@ -84,15 +86,9 @@ struct AggregateFloat { float v; };
}
-(void)takeVector2:(float3)v AVAILABLE_MACOS_10_10 {
#ifdef MAC
// expected-error@-2 {{'float3' (vector of 3 'float' values) parameter type is unsupported}}
#endif
}
- (__m128)retM128_2 AVAILABLE_MACOS_10_10 {
#ifdef MAC
// expected-error@-2 {{'__m128' (vector of 4 'float' values) return type is unsupported}}
#endif
__m128 value;
return value;
}
@ -101,9 +97,6 @@ struct AggregateFloat { float v; };
}
-(void)takeVector4:(float3)v AVAILABLE_IOS_8 {
#ifdef IOS
// expected-error@-2 {{'float3' (vector of 3 'float' values) parameter type is unsupported}}
#endif
}
-(void)takeVector5:(float3)v AVAILABLE_IOS_9 { // no error