[cfe-dev] Generated function call
Wei Pan
wei.pan9 at gmail.com
Mon Jan 16 21:29:32 PST 2012
Hi all,
I tried to twist a bit the AST by turning a very simple statement into a
function and invoking in a statement as follows
void caller() { global_var++; }
===>
void _implicit_body() { global_var++; } // _implicit_body added into the
translation unit via addDecl
void _implicit_invoker(void *f) {
void (*fptr)() = (void(*)()) f;
fptr();
}
void caller() {
_implicit_invoker((void*)implicit_body); // CallExpr
}
The generated AST looks fine. However the generated code is broken since
there is *no* code generated for function _implict_body. I am wondering if
there is a way to mark a function such that codegen always generates code
for this function.
Thanks,
Wei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120117/845b84ea/attachment.html>
More information about the cfe-dev
mailing list