mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 01:18:53 +00:00
0f1c1be196
We have a new policy in place making links to private resources something we try to avoid in source and test files. Normally, we'd organically switch to the new policy rather than make a sweeping change across a project. However, Clang is in a somewhat special circumstance currently: recently, I've had several new contributors run into rdar links around test code which their patch was changing the behavior of. This turns out to be a surprisingly bad experience, especially for newer folks, for a handful of reasons: not understanding what the link is and feeling intimidated by it, wondering whether their changes are actually breaking something important to a downstream in some way, having to hunt down strangers not involved with the patch to impose on them for help, accidental pressure from asking for potentially private IP to be made public, etc. Because folks run into these links entirely by chance (through fixing bugs or working on new features), there's not really a set of problematic links to focus on -- all of the links have basically the same potential for causing these problems. As a result, this is an omnibus patch to remove all such links. This was not a mechanical change; it was done by manually searching for rdar, radar, radr, and other variants to find all the various problematic links. From there, I tried to retain or reword the surrounding comments so that we would lose as little context as possible. However, because most links were just a plain link with no supporting context, the majority of the changes are simple removals. Differential Review: https://reviews.llvm.org/D158071
83 lines
5.2 KiB
C++
83 lines
5.2 KiB
C++
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown -fsyntax-only -verify %s
|
|
typedef int __v2si __attribute__((__vector_size__(8)));
|
|
typedef short __v4hi __attribute__((__vector_size__(8)));
|
|
typedef short __v8hi __attribute__((__vector_size__(16)));
|
|
typedef short __v3hi __attribute__((__ext_vector_type__(3)));
|
|
|
|
struct S { }; // expected-note 3 {{candidate constructor}}
|
|
|
|
enum E : long long { Evalue };
|
|
|
|
void f() {
|
|
__v2si v2si;
|
|
__v3hi v3hi;
|
|
__v4hi v4hi;
|
|
__v8hi v8hi;
|
|
unsigned long long ll;
|
|
unsigned char c;
|
|
S s;
|
|
E e;
|
|
|
|
(void)reinterpret_cast<__v2si>(v4hi);
|
|
(void)(__v2si)v4hi;
|
|
(void)reinterpret_cast<__v4hi>(v2si);
|
|
(void)(__v4hi)v2si;
|
|
(void)reinterpret_cast<unsigned long long>(v2si);
|
|
(void)(unsigned long long)v2si;
|
|
(void)reinterpret_cast<__v2si>(ll);
|
|
(void)(__v2si)(ll);
|
|
|
|
(void)(E)v2si; // expected-error {{C-style cast from '__v2si' (vector of 2 'int' values) to 'E' is not allowed}}
|
|
(void)(__v2si)e; // expected-error {{C-style cast from 'E' to '__v2si' (vector of 2 'int' values)}}
|
|
(void)reinterpret_cast<E>(v2si); // expected-error {{reinterpret_cast from '__v2si' (vector of 2 'int' values) to 'E' is not allowed}}
|
|
(void)reinterpret_cast<__v2si>(e); // expected-error {{reinterpret_cast from 'E' to '__v2si' (vector of 2 'int' values)}}
|
|
|
|
(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' (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' (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}}
|
|
|
|
(void)(__v3hi)v4hi; // expected-error {{C-style cast from vector '__v4hi' (vector of 4 'short' values) to vector '__v3hi' (vector of 3 'short' values) of different size}}
|
|
(void)(__v3hi)v2si; // expected-error {{C-style cast from vector '__v2si' (vector of 2 'int' values) to vector '__v3hi' (vector of 3 'short' values) of different size}}
|
|
(void)(__v4hi)v3hi; // expected-error {{C-style cast from vector '__v3hi' (vector of 3 'short' values) to vector '__v4hi' (vector of 4 'short' values) of different size}}
|
|
(void)(__v2si)v3hi; // expected-error {{C-style cast from vector '__v3hi' (vector of 3 'short' values) to vector '__v2si' (vector of 2 'int' values) of different size}}
|
|
(void)reinterpret_cast<__v3hi>(v4hi); // expected-error {{reinterpret_cast from vector '__v4hi' (vector of 4 'short' values) to vector '__v3hi' (vector of 3 'short' values) of different size}}
|
|
(void)reinterpret_cast<__v3hi>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' (vector of 2 'int' values) to vector '__v3hi' (vector of 3 'short' values) of different size}}
|
|
(void)reinterpret_cast<__v4hi>(v3hi); // expected-error {{reinterpret_cast from vector '__v3hi' (vector of 3 'short' values) to vector '__v4hi' (vector of 4 'short' values) of different size}}
|
|
(void)reinterpret_cast<__v2si>(v3hi); // expected-error {{reinterpret_cast from vector '__v3hi' (vector of 3 'short' values) to vector '__v2si' (vector of 2 'int' values) of different size}}
|
|
}
|
|
|
|
struct testvec {
|
|
__v2si v;
|
|
void madd(const testvec& rhs) {
|
|
v = v + rhs; // expected-error {{cannot convert between vector and non-scalar values}}
|
|
}
|
|
void madd2(testvec rhs) {
|
|
v = v + rhs; // expected-error {{cannot convert between vector and non-scalar values}}
|
|
}
|
|
};
|
|
|
|
// Conversions for return values.
|
|
__v4hi threeToFour(__v3hi v) { // expected-note {{not viable}}
|
|
return v; // expected-error {{cannot initialize return object}}
|
|
}
|
|
__v3hi fourToThree(__v4hi v) { // expected-note {{not viable}}
|
|
return v; // expected-error {{cannot initialize return object}}
|
|
}
|
|
// Conversions for calls.
|
|
void call3to4(__v4hi v) {
|
|
(void) threeToFour(v); // expected-error {{no matching function for call}}
|
|
}
|
|
void call4to3(__v3hi v) {
|
|
(void) fourToThree(v); // expected-error {{no matching function for call}}
|
|
}
|