Sorry for the delay.<br><br>Unfortunately the LLVM/Clang mailing list and IRC channel is not much help, no one seems to be familiar with this functionality. I'm trying to use this in a Pass and I'm assuming I would need to call CodeGen a 2nd time(since I doubt I could set that option in time before its ran), but I dont understand any potential consequences from this.<br>
<br>Any advice? Anyone happen to know of some code where this is being done(I'm not entirely sure how to call CodeGen again)?<br><br>Thanks<br>

<br><div class="gmail_quote">On Wed, Jul 27, 2011 at 4:21 PM, Sean Callanan <span dir="ltr"><<a href="mailto:scallanan@apple.com" target="_blank">scallanan@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">


<div style="word-wrap:break-word">EmitDeclMetadata generates a mapping from values in the IR that Clang emits to their original Clang ASTs.  In an expression like<div><br></div><div>(lldb) expr a</div><div><br></div><div>


Clang asks LLDB about "a" and LLDB returns a variety of Decls (maybe one for a(), a function, and one for a, a variable).   Clang sorts out which one it needs, and uses the metadata to indicate which Decl it actually ended up using.  Later when LLDB sees the Decl in the metadata for the emitted IR, it can use ClangExpressionDeclMap to locate the corresponding LLDB entity (say, a VariableSP), and use information about that entity when actually running the expression.</div>


<div><div><br></div><div>InstrumentFunctions was (and may still be) enabled by default, and added calls to __cyg_profile_func_enter/__cyg_profile_func_exit at the boundaries of each emitted function.  We have no use for these calls, and they were generating undefined references.  I disabled them.</div>


<div><br></div><font color="#888888"><div>Sean</div><div><br></div></font><div><div><div><div>On Jul 27, 2011, at 11:49 AM, ret val wrote:</div><br></div><div><div></div><div><blockquote type="cite">
Sorry, guess I should of been more specific. Those lines I found, Im just not sure how they are used. <br><br>After those are enabled, how could something like a Pass take advantage of it and get a Decl for something it finds? I browsed the code and didnt notice anything special for this, not sure what I missing.<br>



<br>Thanks though<br><br><div class="gmail_quote">On Wed, Jul 27, 2011 at 2:39 PM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">



We typically enable a certain set of options by default with our expression parser by setting the hard coded option manually. See the "ClangExpressionParser::ClangExpressionParser(...)" constructor functions. If you look at the current sources we currently enable this:<br>




<br>
238    // Set CodeGen options<br>
239    m_compiler->getCodeGenOpts().EmitDeclMetadata = true;<br>
240    m_compiler->getCodeGenOpts().InstrumentFunctions = false;<br>
<div><div></div><div><br>
<br>
On Jul 26, 2011, at 7:18 AM, ret val wrote:<br>
<br>
> Hi<br>
><br>
> I'm working with LLVM/Clang and I'm trying to use the clang::CodeGenOptions::EmitDeclMetadata feature. There really arnt docs for anything like this so thanks to lldb/Expression/ClangExpressionParser.cpp I now know how to enable this feature. Can anyone point me to a usage of this? I'm not entirely sure how it should work and nothing stood out to me.<br>




><br>
> Thanks<br>
</div></div>> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote></div><br>
_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">lldb-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>


</blockquote></div></div></div><br></div></div></div></blockquote></div><br>