Commit Graph

9 Commits

Author SHA1 Message Date
Davide Italiano 32cbff7809 [Sema] Be consistent about diagnostic wording: always use "cannot".
Discussed with Richard Smith.

llvm-svn: 245162
2015-08-15 15:23:14 +00:00
John McCall 1c78f085c3 Fix the equal-vector-size rule for reinterpret_casts in C++
to consider the storage size of the vector instead of its
sizeof.  In other words, ban <3 x int> to <4 x int> casts,
which produced invalid IR anyway.

Also, attempt to be a little more rigorous, or at least
explicit, about when enums are allowed in these casts.

rdar://21901132

llvm-svn: 243069
2015-07-23 23:54:07 +00:00
Benjamin Kramer 1adc8c3391 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.

llvm-svn: 207267
2014-04-25 20:41:38 +00:00
John McCall 9b595db16d Tighten lax vector-conversion rules and enforce them consistently.
When a lax conversion featured a vector and a non-vector, we were
only requiring the non-vector to be a scalar type, but really it
needs to be a real type (i.e. integral or real floating); it is
not reasonable to allow a pointer, member pointer, or complex
type here.

r198474 required lax conversions to match in "data size", i.e.
element size * element count, forbidding matches that happen
only because a vector is rounded up to the nearest power of two
in size.  Unfortunately, the erroneous logic was repeated in
several different places; unify them to use the new condition,
so that it triggers for arbitrary conversions and not just
those performed as part of binary operator checking.

rdar://15931426

llvm-svn: 200810
2014-02-04 23:58:19 +00:00
Argyrios Kyrtzidis d07dcdb958 For areVectorOperandsLaxBitCastable(), only return false if both opearands are vector types
and add a diagnostic when the operand is a vector and non-scalar value.

rdar://15722301

llvm-svn: 198680
2014-01-07 07:59:31 +00:00
John McCall 909acf8209 Provide overload diagnostics when explicit casts involving class types fail.
PR8626.

llvm-svn: 125506
2011-02-14 18:34:10 +00:00
John McCall 85f9055955 When pretty-printing tag types, only print the tag if we're in C (and
therefore not creating ElaboratedTypes, which are still pretty-printed
with the written tag).

Most of these testcase changes were done by script, so don't feel too
sorry for my fingers.

llvm-svn: 98149
2010-03-10 11:27:22 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Anders Carlsson 570af5d426 Improve handling of vector casts in C++.
llvm-svn: 82072
2009-09-16 19:19:43 +00:00