[clang] [clang][Builtins] Parse clang extended vectors types. (PR #83584)
Francesco Petrogalli via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 1 11:24:35 PST 2024
fpetrogalli wrote:
> > @philnik777 - thank you for the patch at #68324
>
> You're welcome!
>
> FWIW I'd find a syntax like `_ExtVector<bool, 4>` better. The underscore and upper case to make it clear that it's non-standard and the angle bracket syntax since it's kind-of a template. This unfortunately doesn't map really nicely to anything native otherwise. Maybe think of it like
>
> ```c++
> template <class T, unsigned N>
> using _ExtVector __attribute__((ext_vector_type(N))) = T;
> ```
>
> Then you'd actually use it as `_ExtVector<bool, 4>` in source code. I don't think that would be significantly harder to parse.
I am almost there. Before going a bit wider with tests I wanted to let you know that, to keep the parsing operation simple, I have opted for `_ExtVector<N:T>` [1]. The reason being that the token `','` is already used to split the parameters of the prototype.
Shall we rework the parser to make it compatible with template-style parameters? I like the idea a lot, I am just not sure it is worth pursuing this extra complication.
Francesco
[1] It will become `_ExtVector<T:N>` if I get your blessing for the split with ':' instead of ','.
https://github.com/llvm/llvm-project/pull/83584
More information about the cfe-commits
mailing list