[cfe-dev] constructor notation for vector types

Chris Lattner clattner at apple.com
Wed Oct 14 15:07:32 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?

Hi Jochen,

In a language like opencl, the "opencl compiler" typically implicitly  
#includes a header that sets up a bunch of #defines, typedefs, builtin  
function declarations etc.  I think that int4 should just be a class  
defined in the header, and then everything would just work.

-Chris



More information about the cfe-dev mailing list