[cfe-dev] Adding new data type

Renato Golin rengolin at systemcall.org
Thu Apr 29 01:06:25 PDT 2010

On 28 April 2010 23:36, kalyan ponnala <ponnala.kalyan at gmail.com> wrote:
> Hello Group,
> I am trying to add a new data type to clang. Can someone tell me the
> important files and classes to look into and how to start in order to lex
> and parse and generate an AST node to this new data type.

First you have to add the new type to the Type hierarchy. See
include/llvm/Type.h and its derived classes, find a suitable spot and
implement it.

Then you have to change the type handlers in clang to, based on the
source's type, add your custom type to the AST.

I'm not sure that LLVM's subsequent passes will recognize all
properties of your new type, but I guess if you build it well enough,
it might go on unnoticed.

Out of curiosity, what is this new type you need?



Reclaim your digital rights, eliminate DRM, learn more at

More information about the cfe-dev mailing list