aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-04-25 20:41:38 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-04-25 20:41:38 +0000
commitf0b65979d2eea490104c8f6a6230cceeda2aab70 (patch)
tree074be3522a280e67245a6fd3fc147db85801cfcc
parentfbba3c174ca9006db4ea9837ccb0294be1ea39d1 (diff)
downloadclang_35a-f0b65979d2eea490104c8f6a6230cceeda2aab70.tar.gz
Print detailed vector type information on diagnostics.
We never aka vector types because our attributed syntax for it is less comprehensible than the typedefs. This leaves the user in the dark when the typedef isn't named that well. Example: v2s v; v4f w; w = v; The naming in this cases isn't even that bad, but the error we give is useless without looking up the actual typedefs. t.c:6:5: error: assigning to 'v4f' from incompatible type 'v2s' Now: t.c:6:5: error: assigning to 'v4f' (vector of 4 'float' values) from incompatible type 'v2s' (vector of 2 'int' values) We do this for all diagnostics that print a vector type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207267 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTDiagnostic.cpp14
-rw-r--r--test/CodeGen/mmx-inline-asm-error.c6
-rw-r--r--test/Parser/altivec.c4
-rw-r--r--test/Parser/cxx-altivec.cpp4
-rw-r--r--test/Parser/opencl-astype.cl2
-rw-r--r--test/Sema/ext_vector_casts.c24
-rw-r--r--test/Sema/transparent-union.c2
-rw-r--r--test/Sema/typedef-retain.c4
-rw-r--r--test/Sema/vector-assign.c40
-rw-r--r--test/Sema/vector-cast.c16
-rw-r--r--test/Sema/vector-init.c2
-rw-r--r--test/Sema/vector-ops.c6
-rw-r--r--test/SemaCXX/vector-casts.cpp22
-rw-r--r--test/SemaCXX/vector.cpp10
-rw-r--r--test/SemaOpenCL/vector_conv_invalid.cl6
15 files changed, 88 insertions, 74 deletions
diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp
index 7c6bec4503..539e666a48 100644
--- a/lib/AST/ASTDiagnostic.cpp
+++ b/lib/AST/ASTDiagnostic.cpp
@@ -228,6 +228,20 @@ ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty,
return S;
}
}
+
+ // Give some additional info on vector types. These are either not desugared
+ // or displaying complex __attribute__ expressions so add details of the
+ // type and element count.
+ if (Ty->isVectorType()) {
+ const VectorType *VTy = Ty->getAs<VectorType>();
+ std::string DecoratedString;
+ llvm::raw_string_ostream OS(DecoratedString);
+ const char *Values = VTy->getNumElements() > 1 ? "values" : "value";
+ OS << "'" << S << "' (vector of " << VTy->getNumElements() << " '"
+ << VTy->getElementType().getAsString(Context.getPrintingPolicy())
+ << "' " << Values << ")";
+ return OS.str();
+ }
}
S = "'" + S + "'";
diff --git a/test/CodeGen/mmx-inline-asm-error.c b/test/CodeGen/mmx-inline-asm-error.c
index a6393682ce..876c664e3b 100644
--- a/test/CodeGen/mmx-inline-asm-error.c
+++ b/test/CodeGen/mmx-inline-asm-error.c
@@ -4,9 +4,9 @@ typedef int vec256 __attribute__((ext_vector_type(8)));
vec256 foo(vec256 in) {
vec256 out;
- asm("something %0" : : "y"(in)); // expected-error {{invalid type 'vec256' in asm input for constraint 'y'}}
- asm("something %0" : "=y"(out)); // expected-error {{invalid type 'vec256' in asm input for constraint 'y'}}
- asm("something %0, %0" : "+y"(out)); // expected-error {{invalid type 'vec256' in asm input for constraint 'y'}}
+ asm("something %0" : : "y"(in)); // expected-error {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
+ asm("something %0" : "=y"(out)); // expected-error {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
+ asm("something %0, %0" : "+y"(out)); // expected-error {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
return out;
}
diff --git a/test/Parser/altivec.c b/test/Parser/altivec.c
index 0bdc3dcffe..436a3afd2d 100644
--- a/test/Parser/altivec.c
+++ b/test/Parser/altivec.c
@@ -103,8 +103,8 @@ void f() {
gccvector unsigned int gv = v;
gccvector int gvi = (gccvector int)v;
__attribute__((vector_size(8))) unsigned int gv8;
- gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
- av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+ gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int' (vector of 4 'unsigned int' values)}}
+ av = gv8; // expected-error {{assigning to '__vector unsigned int' (vector of 4 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values)}}
v = gccv;
__vector unsigned int tv = gccv;
diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp
index be00e494fd..27cab2c9c4 100644
--- a/test/Parser/cxx-altivec.cpp
+++ b/test/Parser/cxx-altivec.cpp
@@ -93,8 +93,8 @@ void f() {
gccvector unsigned int gv = v;
gccvector int gvi = (gccvector int)v;
__attribute__((vector_size(8))) unsigned int gv8;
- gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}}
- av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}}
+ gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int' (vector of 4 'unsigned int' values)}}
+ av = gv8; // expected-error {{assigning to '__vector unsigned int' (vector of 4 'unsigned int' values) from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' (vector of 2 'unsigned int' values)}}
v = gccv;
__vector unsigned int tv = gccv;
diff --git a/test/Parser/opencl-astype.cl b/test/Parser/opencl-astype.cl
index d4c547e5cb..72f98a4ace 100644
--- a/test/Parser/opencl-astype.cl
+++ b/test/Parser/opencl-astype.cl
@@ -11,7 +11,7 @@ void test_astype() {
typedef __attribute__(( ext_vector_type(4) )) double double4;
float4 f4;
- double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of 'double4' and 'float4' must match}}
+ double4 d4 = __builtin_astype(f4, double4); // expected-error{{invalid reinterpretation: sizes of 'double4' (vector of 4 'double' values) and 'float4' (vector of 4 'float' values) must match}}
// Verify int4->float3, float3->int4 works.
int4 i4;
diff --git a/test/Sema/ext_vector_casts.c b/test/Sema/ext_vector_casts.c
index d60bc3c65c..949d67311b 100644
--- a/test/Sema/ext_vector_casts.c
+++ b/test/Sema/ext_vector_casts.c
@@ -32,30 +32,30 @@ static void test() {
ivec4 = (int4)5;
ivec4 = (int4)vec4_3;
- i = (int)ivec4; // expected-error {{invalid conversion between vector type 'int4' and integer type 'int' of different size}}
- i = ivec4; // expected-error {{assigning to 'int' from incompatible type 'int4'}}
+ i = (int)ivec4; // expected-error {{invalid conversion between vector type 'int4' (vector of 4 'int' values) and integer type 'int' of different size}}
+ i = ivec4; // expected-error {{assigning to 'int' from incompatible type 'int4' (vector of 4 'int' values)}}
- ivec4 = (int4)ptr; // expected-error {{invalid conversion between vector type 'int4' and scalar type 'int *'}}
+ ivec4 = (int4)ptr; // expected-error {{invalid conversion between vector type 'int4' (vector of 4 'int' values) and scalar type 'int *'}}
- vec4 = (float4)vec2; // expected-error {{invalid conversion between ext-vector type 'float4' and 'float2'}}
+ vec4 = (float4)vec2; // expected-error {{invalid conversion between ext-vector type 'float4' (vector of 4 'float' values) and 'float2' (vector of 2 'float' values)}}
ish8 += 5;
ivec4 *= 5;
vec4 /= 5.2f;
- vec4 %= 4; // expected-error {{invalid operands to binary expression ('float4' and 'int')}}
+ vec4 %= 4; // expected-error {{invalid operands to binary expression ('float4' (vector of 4 'float' values) and 'int')}}
ivec4 %= 4;
- ivec4 += vec4; // expected-error {{can't convert between vector values of different size ('int4' and 'float4')}}
+ ivec4 += vec4; // expected-error {{can't convert between vector values of different size ('int4' (vector of 4 'int' values) and 'float4' (vector of 4 'float' values))}}
ivec4 += (int4)vec4;
ivec4 -= ivec4;
ivec4 |= ivec4;
- ivec4 += ptr; // expected-error {{can't convert between vector and non-scalar values ('int4' and 'int *')}}
+ ivec4 += ptr; // expected-error {{can't convert between vector and non-scalar values ('int4' (vector of 4 'int' values) and 'int *')}}
}
-typedef __attribute__(( ext_vector_type(2) )) float2 vecfloat2; // expected-error{{invalid vector element type 'float2'}}
+typedef __attribute__(( ext_vector_type(2) )) float2 vecfloat2; // expected-error{{invalid vector element type 'float2' (vector of 2 'float' values)}}
void inc(float2 f2) {
- f2++; // expected-error{{cannot increment value of type 'float2'}}
- __real f2; // expected-error{{invalid type 'float2' to __real operator}}
+ f2++; // expected-error{{cannot increment value of type 'float2' (vector of 2 'float' values)}}
+ __real f2; // expected-error{{invalid type 'float2' (vector of 2 'float' values) to __real operator}}
}
typedef enum
@@ -86,7 +86,7 @@ typedef float C3DVector3 __attribute__((ext_vector_type(3)));
extern float32x4_t vabsq_f32(float32x4_t __a);
C3DVector3 Func(const C3DVector3 a) {
- return (C3DVector3)vabsq_f32((float32x4_t)a); // expected-error {{invalid conversion between ext-vector type 'float32x4_t' and 'C3DVector3'}}
+ return (C3DVector3)vabsq_f32((float32x4_t)a); // expected-error {{invalid conversion between ext-vector type 'float32x4_t' (vector of 4 'float' values) and 'C3DVector3' (vector of 3 'float' values)}}
}
// rdar://16350802
@@ -99,7 +99,7 @@ static void splats(int i, long l, __uint128_t t, float f, double d) {
float2 vf = f;
double2 vd = d;
- vs = 65536 + vs; // expected-warning {{implicit conversion from 'int' to 'short8' changes value from 65536 to 0}}
+ vs = 65536 + vs; // expected-warning {{implicit conversion from 'int' to 'short8' (vector of 8 'short' values) changes value from 65536 to 0}}
vs = vs + i; // expected-warning {{implicit conversion loses integer precision}}
vs = vs + 1;
vs = vs + 1.f; // expected-error {{can't convert between vector values of different size}}
diff --git a/test/Sema/transparent-union.c b/test/Sema/transparent-union.c
index eff7df67b9..8ef70bb1c7 100644
--- a/test/Sema/transparent-union.c
+++ b/test/Sema/transparent-union.c
@@ -67,7 +67,7 @@ typedef union { } TU4 __attribute__((transparent_union)); // expected-warning{{f
typedef int int4 __attribute__((ext_vector_type(4)));
typedef union {
- int4 vec; // expected-warning{{first field of a transparent union cannot have vector type 'int4'; transparent_union attribute ignored}}
+ int4 vec; // expected-warning{{first field of a transparent union cannot have vector type 'int4' (vector of 4 'int' values); transparent_union attribute ignored}}
} TU5 __attribute__((transparent_union));
union pr15134 {
diff --git a/test/Sema/typedef-retain.c b/test/Sema/typedef-retain.c
index a7173b7877..d216466360 100644
--- a/test/Sema/typedef-retain.c
+++ b/test/Sema/typedef-retain.c
@@ -5,11 +5,11 @@ typedef int int4 __attribute__((vector_size(16)));
typedef int4* int4p;
void test1(float4 a, int4 *result, int i) {
- result[i] = a; // expected-error {{assigning to 'int4' from incompatible type 'float4'}}
+ result[i] = a; // expected-error {{assigning to 'int4' (vector of 4 'int' values) from incompatible type 'float4' (vector of 4 'float' values)}}
}
void test2(float4 a, int4p result, int i) {
- result[i] = a; // expected-error {{assigning to 'int4' from incompatible type 'float4'}}
+ result[i] = a; // expected-error {{assigning to 'int4' (vector of 4 'int' values) from incompatible type 'float4' (vector of 4 'float' values)}}
}
// PR2039
diff --git a/test/Sema/vector-assign.c b/test/Sema/vector-assign.c
index f01eb456a1..ad3406e304 100644
--- a/test/Sema/vector-assign.c
+++ b/test/Sema/vector-assign.c
@@ -12,30 +12,30 @@ void test1() {
v2f v4;
v4ss v5;
- v1 = v2; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v2u'}}
- v1 = v3; // expected-error {{assigning to 'v2s' from incompatible type 'v1s'}}
- v1 = v4; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v2f'}}
- v1 = v5; // expected-warning {{incompatible vector types assigning to 'v2s' from 'v4ss'}}
+ v1 = v2; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v2u' (vector of 2 'unsigned int' values)}}
+ v1 = v3; // expected-error {{assigning to 'v2s' (vector of 2 'int' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
+ v1 = v4; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v2f' (vector of 2 'float' values)}}
+ v1 = v5; // expected-warning {{incompatible vector types assigning to 'v2s' (vector of 2 'int' values) from 'v4ss' (vector of 4 'short' values)}}
- v2 = v1; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v2s'}}
- v2 = v3; // expected-error {{assigning to 'v2u' from incompatible type 'v1s'}}
- v2 = v4; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v2f'}}
- v2 = v5; // expected-warning {{incompatible vector types assigning to 'v2u' from 'v4ss'}}
+ v2 = v1; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v2s' (vector of 2 'int' values)}}
+ v2 = v3; // expected-error {{assigning to 'v2u' (vector of 2 'unsigned int' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
+ v2 = v4; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v2f' (vector of 2 'float' values)}}
+ v2 = v5; // expected-warning {{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'v4ss' (vector of 4 'short' values)}}
- v3 = v1; // expected-error {{assigning to 'v1s' from incompatible type 'v2s'}}
- v3 = v2; // expected-error {{assigning to 'v1s' from incompatible type 'v2u'}}
- v3 = v4; // expected-error {{assigning to 'v1s' from incompatible type 'v2f'}}
- v3 = v5; // expected-error {{assigning to 'v1s' from incompatible type 'v4ss'}}
+ v3 = v1; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2s' (vector of 2 'int' values)}}
+ v3 = v2; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2u' (vector of 2 'unsigned int' values)}}
+ v3 = v4; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v2f' (vector of 2 'float' values)}}
+ v3 = v5; // expected-error {{assigning to 'v1s' (vector of 1 'int' value) from incompatible type 'v4ss'}}
- v4 = v1; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v2s'}}
- v4 = v2; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v2u'}}
- v4 = v3; // expected-error {{assigning to 'v2f' from incompatible type 'v1s'}}
- v4 = v5; // expected-warning {{incompatible vector types assigning to 'v2f' from 'v4ss'}}
+ v4 = v1; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v2s' (vector of 2 'int' values)}}
+ v4 = v2; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v2u' (vector of 2 'unsigned int' values)}}
+ v4 = v3; // expected-error {{assigning to 'v2f' (vector of 2 'float' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
+ v4 = v5; // expected-warning {{incompatible vector types assigning to 'v2f' (vector of 2 'float' values) from 'v4ss' (vector of 4 'short' values)}}
- v5 = v1; // expected-warning {{incompatible vector types assigning to 'v4ss' from 'v2s'}}
- v5 = v2; // expected-warning {{incompatible vector types assigning to 'v4ss' from 'v2u'}}
- v5 = v3; // expected-error {{assigning to 'v4ss' from incompatible type 'v1s'}}
- v5 = v4; // expected-warning {{incompatible vector types assigning to 'v4ss' from 'v2f'}}
+ v5 = v1; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2s' (vector of 2 'int' values)}}
+ v5 = v2; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2u' (vector of 2 'unsigned int' values)}}
+ v5 = v3; // expected-error {{assigning to 'v4ss' (vector of 4 'short' values) from incompatible type 'v1s' (vector of 1 'int' value)}}
+ v5 = v4; // expected-warning {{incompatible vector types assigning to 'v4ss' (vector of 4 'short' values) from 'v2f'}}
}
// PR2263
diff --git a/test/Sema/vector-cast.c b/test/Sema/vector-cast.c
index bfc731e7b0..6d22deec94 100644
--- a/test/Sema/vector-cast.c
+++ b/test/Sema/vector-cast.c
@@ -11,29 +11,29 @@ void f()
t3 v3;
v2 = (t2)v1; // expected-error {{invalid conversion between vector type \
-'t2' and 't1' of different size}}
+'t2' (vector of 16 'char' values) and 't1' (vector of 1 'long long' value) of different size}}
v1 = (t1)v2; // expected-error {{invalid conversion between vector type \
-'t1' and 't2' of different size}}
+'t1' (vector of 1 'long long' value) and 't2' (vector of 16 'char' values) of different size}}
v3 = (t3)v2;
v1 = (t1)(char *)10; // expected-error {{invalid conversion between vector \
-type 't1' and scalar type 'char *'}}
+type 't1' (vector of 1 'long long' value) and scalar type 'char *'}}
v1 = (t1)(long long)10;
v1 = (t1)(short)10; // expected-error {{invalid conversion between vector \
-type 't1' and integer type 'short' of different size}}
+type 't1' (vector of 1 'long long' value) and integer type 'short' of different size}}
long long r1 = (long long)v1;
short r2 = (short)v1; // expected-error {{invalid conversion between vector \
-type 't1' and integer type 'short' of different size}}
+type 't1' (vector of 1 'long long' value) and integer type 'short' of different size}}
char *r3 = (char *)v1; // expected-error {{invalid conversion between vector\
- type 't1' and scalar type 'char *'}}
+ type 't1' (vector of 1 'long long' value) and scalar type 'char *'}}
}
void f2(t2 X); // expected-note{{passing argument to parameter 'X' here}}
void f3(t3 Y) {
- f2(Y); // expected-warning {{incompatible vector types passing 't3' to parameter of type 't2'}}
+ f2(Y); // expected-warning {{incompatible vector types passing 't3' (vector of 4 'float' values) to parameter of type 't2' (vector of 16 'char' values)}}
}
typedef float float2 __attribute__ ((vector_size (8)));
@@ -51,6 +51,6 @@ typedef short short_sizeof_pointer __attribute__((vector_size(sizeof(void*))));
void f5() {
short_sizeof_pointer v;
void *ptr;
- v = ptr; // expected-error {{assigning to 'short_sizeof_pointer' from incompatible type 'void *'}}
+ v = ptr; // expected-error {{assigning to 'short_sizeof_pointer' (vector of 4 'short' values) from incompatible type 'void *'}}
ptr = v; // expected-error {{assigning to 'void *' from incompatible type 'short_sizeof_pointer'}}
}
diff --git a/test/Sema/vector-init.c b/test/Sema/vector-init.c
index 5be040ae6c..9f27bb882e 100644
--- a/test/Sema/vector-init.c
+++ b/test/Sema/vector-init.c
@@ -40,5 +40,5 @@ typedef short __attribute__((vector_size(8))) short4;
void test3() {
extern short8 test3_helper(void);
longlong2 arr1[2] = { test3_helper(), test3_helper() };
- short4 arr2[2] = { test3_helper(), test3_helper() }; // expected-error 2 {{initializing 'short4' with an expression of incompatible type 'short8'}}
+ short4 arr2[2] = { test3_helper(), test3_helper() }; // expected-error 2 {{initializing 'short4' (vector of 4 'short' values) with an expression of incompatible type 'short8' (vector of 8 'short' values)}}
}
diff --git a/test/Sema/vector-ops.c b/test/Sema/vector-ops.c
index 652a076c78..f2953417f5 100644
--- a/test/Sema/vector-ops.c
+++ b/test/Sema/vector-ops.c
@@ -10,14 +10,14 @@ void test1(v2u v2ua, v2s v2sa, v2f v2fa) {
// Unary operators
(void)(~v2ua);
- (void)(~v2fa); // expected-error{{invalid argument type 'v2f' to unary}}
+ (void)(~v2fa); // expected-error{{invalid argument type 'v2f' (vector of 2 'float' values) to unary}}
// Comparison operators
- v2ua = (v2ua==v2sa); // expected-warning{{incompatible vector types assigning to 'v2u' from 'int __attribute__((ext_vector_type(2)))'}}
+ v2ua = (v2ua==v2sa); // expected-warning{{incompatible vector types assigning to 'v2u' (vector of 2 'unsigned int' values) from 'int __attribute__((ext_vector_type(2)))' (vector of 2 'int' values)}}
v2sa = (v2ua==v2sa);
// Arrays
- int array1[v2ua]; // expected-error{{size of array has non-integer type 'v2u'}}
+ int array1[v2ua]; // expected-error{{size of array has non-integer type 'v2u' (vector of 2 'unsigned int' values)}}
int array2[17];
// FIXME: error message below needs type!
(void)(array2[v2ua]); // expected-error{{array subscript is not an integer}}
diff --git a/test/SemaCXX/vector-casts.cpp b/test/SemaCXX/vector-casts.cpp
index 3aa097b652..2ccd5979c7 100644
--- a/test/SemaCXX/vector-casts.cpp
+++ b/test/SemaCXX/vector-casts.cpp
@@ -23,19 +23,19 @@ void f() {
(void)reinterpret_cast<__v2si>(ll);
(void)(__v2si)(ll);
- (void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' to 'S' is not allowed}}
- (void)(S)v2si; // expected-error {{no matching conversion for C-style cast from '__v2si' to 'S'}}
- (void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'S' to '__v2si' is not allowed}}
- (void)(__v2si)s; // expected-error {{cannot convert 'S' to '__v2si' without a conversion operator}}
+ (void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' (vector of 2 'int' values) to 'S' is not allowed}}
+ (void)(S)v2si; // expected-error {{no matching conversion for C-style cast from '__v2si' (vector of 2 'int' values) to 'S'}}
+ (void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'S' to '__v2si' (vector of 2 'int' values) is not allowed}}
+ (void)(__v2si)s; // expected-error {{cannot convert 'S' to '__v2si' (vector of 2 'int' values) without a conversion operator}}
- (void)reinterpret_cast<unsigned char>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' to scalar 'unsigned char' of different size}}
- (void)(unsigned char)v2si; // expected-error {{C-style cast from vector '__v2si' to scalar 'unsigned char' of different size}}
- (void)reinterpret_cast<__v2si>(c); // expected-error {{reinterpret_cast from scalar 'unsigned char' to vector '__v2si' of different size}}
+ (void)reinterpret_cast<unsigned char>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' (vector of 2 'int' values) to scalar 'unsigned char' of different size}}
+ (void)(unsigned char)v2si; // expected-error {{C-style cast from vector '__v2si' (vector of 2 'int' values) to scalar 'unsigned char' of different size}}
+ (void)reinterpret_cast<__v2si>(c); // expected-error {{reinterpret_cast from scalar 'unsigned char' to vector '__v2si' (vector of 2 'int' values) of different size}}
- (void)reinterpret_cast<__v8hi>(v4hi); // expected-error {{reinterpret_cast from vector '__v4hi' to vector '__v8hi' of different size}}
- (void)(__v8hi)v4hi; // expected-error {{C-style cast from vector '__v4hi' to vector '__v8hi' of different size}}
- (void)reinterpret_cast<__v4hi>(v8hi); // expected-error {{reinterpret_cast from vector '__v8hi' to vector '__v4hi' of different size}}
- (void)(__v4hi)v8hi; // expected-error {{C-style cast from vector '__v8hi' to vector '__v4hi' of different size}}
+ (void)reinterpret_cast<__v8hi>(v4hi); // expected-error {{reinterpret_cast from vector '__v4hi' (vector of 4 'short' values) to vector '__v8hi' (vector of 8 'short' values) of different size}}
+ (void)(__v8hi)v4hi; // expected-error {{C-style cast from vector '__v4hi' (vector of 4 'short' values) to vector '__v8hi' (vector of 8 'short' values) of different size}}
+ (void)reinterpret_cast<__v4hi>(v8hi); // expected-error {{reinterpret_cast from vector '__v8hi' (vector of 8 'short' values) to vector '__v4hi' (vector of 4 'short' values) of different size}}
+ (void)(__v4hi)v8hi; // expected-error {{C-style cast from vector '__v8hi' (vector of 8 'short' values) to vector '__v4hi' (vector of 4 'short' values) of different size}}
}
struct testvec {
diff --git a/test/SemaCXX/vector.cpp b/test/SemaCXX/vector.cpp
index 7957c23e3e..bcd7fedb4d 100644
--- a/test/SemaCXX/vector.cpp
+++ b/test/SemaCXX/vector.cpp
@@ -24,8 +24,8 @@ void f1_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
f1(ll16e); // expected-error{{call to 'f1' is ambiguous}}
}
-void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' to 'char16_e' for 1st argument}} \
- // expected-note{{candidate function not viable: no known conversion from 'convertible_to<longlong16_e>' to 'char16_e' for 1st argument}}
+void f2(char16_e); // expected-note{{no known conversion from 'longlong16_e' (vector of 2 'long long' values) to 'char16_e' (vector of 16 'char' values) for 1st argument}} \
+ // expected-note{{candidate function not viable: no known conversion from 'convertible_to<longlong16_e>' to 'char16_e' (vector of 16 'char' values) for 1st argument}}
void f2_test(char16 c16, longlong16 ll16, char16_e c16e, longlong16_e ll16e) {
f2(c16);
@@ -85,7 +85,7 @@ void casts(longlong16 ll16, longlong16_e ll16e) {
(void)static_cast<longlong16>(ll16);
(void)static_cast<longlong16_e>(ll16);
(void)static_cast<char16>(ll16e);
- (void)static_cast<char16_e>(ll16e); // expected-error{{static_cast from 'longlong16_e' to 'char16_e' is not allowed}}
+ (void)static_cast<char16_e>(ll16e); // expected-error{{static_cast from 'longlong16_e' (vector of 2 'long long' values) to 'char16_e' (vector of 16 'char' values) is not allowed}}
(void)static_cast<longlong16>(ll16e);
(void)static_cast<longlong16_e>(ll16e);
@@ -194,11 +194,11 @@ typedef float fltx4 __attribute__((__vector_size__(16)));
typedef double dblx2 __attribute__((__vector_size__(16)));
typedef double dblx4 __attribute__((__vector_size__(32)));
-void accept_fltx2(fltx2); // expected-note{{candidate function not viable: no known conversion from 'double' to 'fltx2' for 1st argument}}
+void accept_fltx2(fltx2); // expected-note{{candidate function not viable: no known conversion from 'double' to 'fltx2' (vector of 2 'float' values) for 1st argument}}
void accept_fltx4(fltx4);
void accept_dblx2(dblx2);
void accept_dblx4(dblx4);
-void accept_bool(bool); // expected-note{{candidate function not viable: no known conversion from 'fltx2' to 'bool' for 1st argument}}
+void accept_bool(bool); // expected-note{{candidate function not viable: no known conversion from 'fltx2' (vector of 2 'float' values) to 'bool' for 1st argument}}
void test(fltx2 fltx2_val, fltx4 fltx4_val, dblx2 dblx2_val, dblx4 dblx4_val) {
// Exact matches
diff --git a/test/SemaOpenCL/vector_conv_invalid.cl b/test/SemaOpenCL/vector_conv_invalid.cl
index e6ef5a492f..90cec26a60 100644
--- a/test/SemaOpenCL/vector_conv_invalid.cl
+++ b/test/SemaOpenCL/vector_conv_invalid.cl
@@ -7,8 +7,8 @@ typedef unsigned uint3 __attribute((ext_vector_type(3)));
void vector_conv_invalid() {
uint4 u = (uint4)(1);
- int4 i = u; // expected-error{{initializing 'int4' with an expression of incompatible type 'uint4'}}
- int4 e = (int4)u; // expected-error{{invalid conversion between ext-vector type 'int4' and 'uint4'}}
+ int4 i = u; // expected-error{{initializing 'int4' (vector of 4 'int' values) with an expression of incompatible type 'uint4' (vector of 4 'unsigned int' values)}}
+ int4 e = (int4)u; // expected-error{{invalid conversion between ext-vector type 'int4' (vector of 4 'int' values) and 'uint4' (vector of 4 'unsigned int' values)}}
- uint3 u4 = (uint3)u; // expected-error{{invalid conversion between ext-vector type 'uint3' and 'uint4'}}
+ uint3 u4 = (uint3)u; // expected-error{{invalid conversion between ext-vector type 'uint3' (vector of 3 'unsigned int' values) and 'uint4' (vector of 4 'unsigned int' values)}}
}