Debian Codegraph @

clang/test/SemaObjC/x86-method-vector-values.m

raw
1 // RUN: %clang_cc1 -verify -DMAC -triple=i686-apple-macosx10.10 -Wno-objc-root-class %s
2 // RUN: %clang_cc1 -verify -DMAC -triple=i686-apple-macosx10.4 -Wno-objc-root-class %s
3 // RUN: %clang_cc1 -verify -DMAC -triple=i686-apple-darwin14 -Wno-objc-root-class %s
4 // RUN: %clang_cc1 -verify -triple=i686-apple-ios8 -Wno-objc-root-class %s
5
6 // RUN: %clang_cc1 -verify -DALLOW -DMAC -triple=i686-apple-macosx10.11 -Wno-objc-root-class %s
7 // RUN: %clang_cc1 -verify -DALLOW -DMAC -triple=i686-apple-darwin15 -Wno-objc-root-class %s
8 // RUN: %clang_cc1 -verify -DALLOW -DIOS -triple=i686-apple-ios9 -Wno-objc-root-class %s
9 // RUN: %clang_cc1 -verify -DALLOW -DOTHER -triple=i686-apple-watchos -Wno-objc-root-class %s
10 // RUN: %clang_cc1 -verify -DALLOW -DOTHER -triple=i686-apple-tvos -Wno-objc-root-class %s
11
12 // RUN: %clang_cc1 -verify -DALLOW -DOTHER -triple=x86_64-apple-macosx10.10 -Wno-objc-root-class %s
13
14 typedef __attribute__((__ext_vector_type__(3))) float float3;
15
16 typedef float __m128 __attribute__((__vector_size__(16)));
17
18 struct Aggregate { __m128 v; };
19 struct AggregateFloat { float v; };
20
21 #define AVAILABLE_MACOS_10_10 __attribute__((availability(macos, introduced = 10.10)))
22 #define AVAILABLE_MACOS_10_11 __attribute__((availability(macos, introduced = 10.11)))
23
24 #define AVAILABLE_IOS_8 __attribute__((availability(ios, introduced = 8.0)))
25 #define AVAILABLE_IOS_9 __attribute__((availability(ios, introduced = 9.0)))
26
27 @interface VectorMethods
28
29 -(void)takeVector:(float3)v; // there should be no diagnostic at declaration
30 -(void)takeM128:(__m128)v;
31
32 @end
33
34 @implementation VectorMethods
35
36 #ifndef ALLOW
37
38 -(void)takeVector:(float3)v {
39 #ifdef MAC
40 // expected-error@-2 {{'float3' (vector of 3 'float' values) parameter type is unsupported; support for vector types for this target is introduced in macOS 10.11}}
41 #else
42 // expected-error@-4 {{'float3' (vector of 3 'float' values) parameter type is unsupported; support for vector types for this target is introduced in iOS 9}}
43 #endif
44 }
45
46 -(float3)retVector { // expected-error {{'float3' (vector of 3 'float' values) return type is unsupported}}
47 }
48
49 -(void)takeVector2:(float3)v AVAILABLE_MACOS_10_10 { // expected-error {{'float3' (vector of 3 'float' values) parameter type is unsupported}}
50 }
51
52 -(void)takeVector3:(float3)v AVAILABLE_MACOS_10_11 { // expected-error {{'float3' (vector of 3 'float' values) parameter type is unsupported}}
53 }
54
55 -(void)takeVector4:(float3)v AVAILABLE_IOS_8 { // expected-error {{'float3' (vector of 3 'float' values) parameter type is unsupported}}
56 }
57
58 -(void)takeVector5:(float3)v AVAILABLE_IOS_9 { // expected-error {{'float3' (vector of 3 'float' values) parameter type is unsupported}}
59 }
60
61 - (__m128)retM128 { // expected-error {{'__m128' (vector of 4 'float' values) return type is unsupported}}
62 }
63
64 - (void)takeM128:(__m128)v { // expected-error {{'__m128' (vector of 4 'float' values) parameter type is unsupported}}
65 }
66
67 #else
68
69 // expected-no-diagnostics
70
71 -(void)takeVector:(float3)v {
72 }
73
74 -(float3)retVector {
75 return 0;
76 }
77
78 - (__m128)retM128 {
79 __m128 value;
80 return value;
81 }
82
83 - (void)takeM128:(__m128)v {
84 }
85
86 -(void)takeVector2:(float3)v AVAILABLE_MACOS_10_10 {
87 }
88
89 - (__m128)retM128_2 AVAILABLE_MACOS_10_10 {
90 __m128 value;
91 return value;
92 }
93
94 -(void)takeVector3:(float3)v AVAILABLE_MACOS_10_11 { // no error
95 }
96
97 -(void)takeVector4:(float3)v AVAILABLE_IOS_8 {
98 }
99
100 -(void)takeVector5:(float3)v AVAILABLE_IOS_9 { // no error
101 }
102
103 #ifdef OTHER
104 // expected-no-diagnostics
105 #endif
106
107 #endif
108
109 -(void)doStuff:(int)m { // no error
110 }
111
112 -(struct Aggregate)takesAndRetVectorInAggregate:(struct Aggregate)f { // no error
113 struct Aggregate result;
114 return result;
115 }
116
117 -(struct AggregateFloat)takesAndRetFloatInAggregate:(struct AggregateFloat)f { // no error
118 struct AggregateFloat result;
119 return result;
120 }
121
122
123 @end