Author: arphaman
Date: Fri May 5 11:15:17 2017
New Revision: 302250
URL: http://llvm.org/viewvc/llvm-project?rev=302250&view=rev
Log:
[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
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjC/x86-method-vector-values.m
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=302250&r1=302249&r2=302250&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri May 5 11:15:17 2017
@@ -4347,10 +4347,8 @@ static void checkObjCMethodX86VectorType
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
Modified: cfe/trunk/test/SemaObjC/x86-method-vector-values.m
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/x86-method-vector-values.m?rev=302250&r1=302249&r2=302250&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/x86-method-vector-values.m (original)
+++ cfe/trunk/test/SemaObjC/x86-method-vector-values.m Fri May 5 11:15:17 2017
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits