<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 14, 2016 at 5:42 PM, Saleem Abdulrasool via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span class="">On Tue, Jun 14, 2016 at 10:07 AM, Keno Fischer via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br></span><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span style="font-size:12.8px">I wanted to revive the idea of adding a feature that would have clang embed its invocation in the created object file (like a compilation database, but internal to the object file). I know this was discussed on the mailing list a few years ago, but as far as I'm aware, there wasn't any progress on this. My use case for this is debugging (rather than reconstruct a clang AST from debug info, just re-parse the correct translation unit and get the complete AST), but I know there are other people interested in this functionality as well. For my use case, I think I'd be happy associating this with the DWARF compilation unit (how to represent this would be something to be discussed, putting it into DW_AT_producer is probably simplest, but there may be other options). Thoughts?</span></div></blockquote><div><br></div></span><div>If you wish to embed it into the DWARF data, then there is a well tested vendor extension that Apple has in LLVM: DW_AT_APPLE_flags.</div><div><br></div><div>That said, I was already looking at adding similar functionality for compatibility with GCC (-frecord-gcc-switches).  The way that this works is that there is a special section embedded which contains an array of C strings which is the command line.  The recorded invocation is the *compiler* invocation, not the driver invocation.</div></div></div></div></blockquote><div><br></div><div>Neat; I didn't know about this GCC option. Apparently there is also a -grecord-gcc-switches which uses DW_AT_producer:</div><div><br></div><div>"""</div><div>This switch causes the command-line options used to invoke the compiler that may affect code generation to be appended to the DW_AT_producer attribute in DWARF debugging information. The options are concatenated with spaces separating them from each other and from the compiler version. It is enabled by default. See also -frecord-gcc-switches for another way of storing compiler options into the object file. <br></div><div>""" - <a href="https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html">https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html</a></div><div><br></div><div>-- Sean Silva</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></span></div><span class=""><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature">Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org</div>
</font></span></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>