How to define class on the fly from LLVM

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

How to define class on the fly from LLVM

Sumner, Brian via cfe-dev
Hi there,

*This is "dev"'s list, shall I post here?*

I have a code generator project which generates C++ code. But it is
somewhat cumbersome, and thus I want to port it to LLVM, i.e. write a
compiler directly instead of code generator.

The thing is it uses some STL containers in C++, not to mention the
supporting code. Rewriting it into LLVM is simply impractical. There are
generated `struct` from the DSL and it is this type passed as template
parameter to many containers.

So I'm planning to make use of clang for this part of code, while port
the core part to LLVM IR. The problem is that the `struct` is defined in
LLVM side now since the DSL syntax differs from C++. But to instantiate
templates, I sure have to notify clang of that. My question is hence,
how can I define a class on the fly with clang? Which clang framework
shall I use?


cfe-dev mailing list
[hidden email]