]> granicus.if.org Git - clang/commitdiff
[ObjC] Don't disallow vector parameters/return values in methods
authorAlex Lorenz <arphaman@gmail.com>
Fri, 5 May 2017 16:15:17 +0000 (16:15 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Fri, 5 May 2017 16:15:17 +0000 (16:15 +0000)
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
test/SemaObjC/x86-method-vector-values.m

index fe9ba6f1f8110c57f8d899a13c08df5c5c7f1730..370461c4a24e4524be8ff9eba929cd8486404e6f 100644 (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
index 6c5189d08427c980f60c2161328df2a3cacee91e..23d07b1b41fa8f9c6fe5ab4b82ee143888848fd4 100644 (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