[cfe-dev] inspecting emitted blocks code
John McCall
rjmccall at apple.com
Wed Mar 23 20:40:43 PDT 2011
On Mar 23, 2011, at 8:21 PM, Abhishek Kulkarni wrote:
> > Finally, is there a way to reach a block's imported variables without modifying the compiler?
>
> If you have the AST, this is the block decl's "captures" list.
>
> I don't know what you mean by "without modifying the compiler", but we strongly encourage people who are interested in analyzing C/C++ programs to work with our AST (or LLVM IR, as appropriate) instead of exporting the information into some other format which is pretty much inevitably going to be a lesser cousin to the AST.
>
>
> Sorry for not being clear -- I meant to ask if there is a way to inspect the closure's data at runtime. If I have the block pointer, can I get the values of the imported variables that the block encapsulates? I have been looking at the blocks runtime that comes with compiler-rt and it is not clear how the imported variables are laid out within the block's descriptor.
There's no reflection information because there aren't any runtime reflection APIs which would consume it. The closest we get is that in ObjC GC mode, we do emit layout information indicating where the pointers are.
John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110323/15da87a3/attachment.html>
More information about the cfe-dev
mailing list