[lldb-dev] using clang::CodeGenOptions::EmitDeclMetadata
Sean Callanan
scallanan at apple.com
Wed Jul 27 13:21:02 PDT 2011
EmitDeclMetadata generates a mapping from values in the IR that Clang emits to their original Clang ASTs. In an expression like
(lldb) expr a
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.
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.
Sean
On Jul 27, 2011, at 11:49 AM, ret val wrote:
> Sorry, guess I should of been more specific. Those lines I found, Im just not sure how they are used.
>
> 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.
>
> Thanks though
>
> On Wed, Jul 27, 2011 at 2:39 PM, Greg Clayton <gclayton at apple.com> wrote:
> 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:
>
> 238 // Set CodeGen options
> 239 m_compiler->getCodeGenOpts().EmitDeclMetadata = true;
> 240 m_compiler->getCodeGenOpts().InstrumentFunctions = false;
>
>
> On Jul 26, 2011, at 7:18 AM, ret val wrote:
>
> > Hi
> >
> > 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.
> >
> > Thanks
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20110727/d2b1935e/attachment.html>
More information about the lldb-dev
mailing list