<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Mar 23, 2011, at 8:21 PM, Abhishek Kulkarni wrote:</div><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div class="im">> Finally, is there a way to reach a block's imported variables without modifying the compiler?<br>
<br>
</div>If you have the AST, this is the block decl's "captures" list.<br>
<br>
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.<br>
<font color="#888888"><br></font></blockquote><div><br></div><div>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.</div>
</div></blockquote></div><div><br></div><div>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.</div><div><br></div><div>John.</div></body></html>