Adding OpenCL format specifiers to printf format checking

I want to add the OpenCL format specifiers to the printf format checking in Clang (i.e. the checking performed for functions declared with attribute((format))). The major difference is that OpenCL's printf allows vector arguments, and there can be a "vector specifier" of the form "vN" specifying the vector length just before the argument type, as in "%v4lf" for type type double4. double4 is declared as

typedef double double4 attribute((ext_vector_type(4)));

I know how to implement parsing the vector specifier etc.

I don't how to match these vector types. I assume I have to modify PrintfSpecifier::getArgType in PrintfFormatString.cpp. This routine currently handles types such as ASTContext.IntTy, and I assume I should extend it to handle the respective vector types as well. How would I go about this?

- Should I extend ASTContext to provide builtin types for all OpenCL vector types?
- Should I instead create vector types corresponding to ASTContext.IntTy on the fly?
- How do I create such a vector type? Would I use ExtVectorType for this?
- Can I just create a new type, or do I need to register/delete it?
- Do you have a pointer to another place in Clang where something similar is already done?