[Sema][SVE] Fix handling of initialisers for built-in SVE types
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 2 Mar 2020 18:33:12 +0000 (18:33 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 6 May 2020 11:24:27 +0000 (12:24 +0100)
commit69ab8b46b84daa42f334ea2dc7a097f7b81bae77
treed045156cab2469350967c22947069c951a074269
parent9b509bca858cbc37ab8e36383f2550d5e2f8a312
[Sema][SVE] Fix handling of initialisers for built-in SVE types

The built-in SVE types are supposed to be treated as opaque types.
This means that for initialisation purposes they should be treated
as a single unit, much like a scalar type.

However, as Eli pointed out, actually using "scalar" in the diagnostics
is likely to cause confusion, given the types are logically vectors.
The patch therefore uses custom diagnostics or generalises existing
ones.  Some of the messages use the word "indivisible" to try to make
it clear(er) that these types can't be initialised elementwise.

I don't think it's possible to trigger warn_braces_around_(scalar_)init
for sizeless types as things stand, since the types can't be used as
members or elements of more complex types.  But it seemed better to be
consistent with ext_many_braces_around_(scalar_)init, so the patch
changes it anyway.

Differential Revision: https://reviews.llvm.org/D76689
clang/docs/DiagnosticsReference.rst
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaInit.cpp
clang/test/Sema/sizeless-1.c
clang/test/SemaCXX/sizeless-1.cpp