From e9b6eb5833703a281f3da4a96b9c3a8674f02829 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Fri, 5 May 2017 16:15:17 +0000 Subject: [PATCH] [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 --- lib/Sema/SemaDeclObjC.cpp | 4 +--- test/SemaObjC/x86-method-vector-values.m | 11 ++--------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index fe9ba6f1f8..370461c4a2 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -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 diff --git a/test/SemaObjC/x86-method-vector-values.m b/test/SemaObjC/x86-method-vector-values.m index 6c5189d084..23d07b1b41 100644 --- a/test/SemaObjC/x86-method-vector-values.m +++ b/test/SemaObjC/x86-method-vector-values.m @@ -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 -- 2.40.0