Clang plugin and CodeGen


We are evaluating adding a new type to llvm. I am focusing on exposing this type in c/c++. For now, I am going to expose it via the attribute annotate, something like:

attribute((annotate(“new_type”))) int x;

I think the main option is to create a new clang TypeNode that will eventually map to the llvm type during the CodeGen phase (e.g. CodeGenTypes::ConvertType).

Since this is still in the experimental phase, I would like to minimize the amount of changes in the main clang source code. Instead of the new TypeNode, is it possible to use a clang plugin to achieve this? I was thinking something like: if the type is an int with this annotation then change type to the new llvm type.

Just want to double check before starting to add the new TypeNode which requires changes in several files.