[cfe-dev] Compile a string?
Daniel Waterworth
da.waterworth at gmail.com
Sat Jun 19 05:22:41 PDT 2010
Sorry, what I mean is I've trying to make/find a function like this:
Module *compile_string(const char *source)
that could be used like this:
Module *m = compile_string("int function(int a, int b) { return a + b; }");
I hope that makes things clearer. Does such a function exist within
clang, or will I have to setup the components to do that? As far as I
can tell, I'll have to use a Preprocessor to start with, but how do I
then generate the AST in order to lower to LLVM's IR.
Daniel
On 19 June 2010 10:33, Eric Christopher <echristo at apple.com> wrote:
>
>
>
> I'm trying to compile a string into a Module so that I can link and
> then JIT it. What would be the best way of doing this?
>
>
> Not quite sure what you mean, but if you're just trying to get a global
> variable into a module you can use a GlobalVariable for that purpose - there
> are some helper routines to create a string. If this isn't what you were
> wondering then would you give a bit more information?
> Thanks!
> -eric
--
active-thought.com
More information about the cfe-dev
mailing list