[cfe-dev] constructor notation for vector types
Douglas Gregor
dgregor at apple.com
Thu Oct 15 09:54:36 PDT 2009
On Oct 14, 2009, at 2:31 PM, Jochen Wilhelmy wrote:
> Hi!
>
> I'm new to clang and want to use it as an embedded language.
> I'd like to add constructor notation to vector types that I
> can write int4(1,2,3,4) instead of (int4)(1,2,3,4).
> This is to have it more cg/hlsl-style or even compile existing
> parts of cg/hlsl programs.
> At first it's ok if it only works in c++ mode and therefore
> I have to start at ActOnCXXTypeConstructExpr.
> Can you give me any hints how to approach this?
Look through the logic in ActOnCXXConstructExpr. You should be able to
add another "if" that looks for a vector type, then find the code
where we handle (int4)(1, 2, 3, 4) and unify the logic for those two.
- Doug
More information about the cfe-dev
mailing list