<div dir="ltr">I see. A quick look in the boost's source code shows that it's used mainly for diagnostics, and defaults to __func__. <div><br></div><div>However, it's also used in CTTI and hanna, which might be a problem.</div><div><br></div><div>I can contact them and ask if the change will break the lib. How about that?</div><div><br></div><div>It wouldn't fix problems with for other libraries that we don't know about though.</div><div><br></div><div>Thank you,</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-01 17:56 GMT+00:00 Keane, Erich <span dir="ltr"><<a href="mailto:erich.keane@intel.com" target="_blank">erich.keane@intel.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div class="m_2610642027829217880WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">This is actually something I’ve talked about quite a bit lately internally. If this were a few years ago before we implemented __PRETTY_FUNCTION__, I definitely
would have been in the camp of matching GCC’s behavior. <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">However, my current opinion (which is only my own), is that we shouldn’t mess with it. There are a couple of libraries that depend on the format to be as it
is. There is a boost library that slips my mind at the moment that does a ton of template magic based on the format of __PRETTY_FUNCTION__ that would be broken and have to be conditionalized. I would fear breaking them again.<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_2610642027829217880__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></a></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> cfe-dev [mailto:<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">cfe-dev-bounces@lists.<wbr>llvm.org</a>]
<b>On Behalf Of </b>Mikhail Ramalho via cfe-dev<br>
<b>Sent:</b> Thursday, February 1, 2018 9:50 AM<br>
<b>To:</b> Mikhail Ramalho via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>Subject:</b> [cfe-dev] __PRETTY_FUNCTION__ in clang<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi all,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I recently noticed that clang and gcc print __PRETTY_FUNCTION__ in different formats, e.g.:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">template <typename T> struct X<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">{<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> X() { std::cout << __PRETTY_FUNCTION__ << '\n';}<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">};<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">X<void> x;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">In gcc:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">X<T>::X() [with T = void]<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">In clang:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">X<void>::X() [T = void]<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I only found a discussion about it from 2011, that added the template args to the output:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="http://clang-developers.42468.n3.nabble.com/clang-and-gcc-implement-PRETTY-FUNCTION-differently-td3550386.html" target="_blank">http://clang-developers.42468.<wbr>n3.nabble.com/clang-and-gcc-<wbr>implement-PRETTY-FUNCTION-<wbr>differently-td3550386.html</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I also created a patch that implements the gcc format, but broke all the diagnostic tests, because it needs the instantiated name to report warning/errors (which is correct in my opinion). <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">One solution would be adding a new attribute in PrintingPolicy to handle the case where we want to print these predefined expressions, then enabling it in PredefinedExpr::<wbr>ComputeName.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222;background:white">Is there any interest in the community to match gcc's output? There are some valid points in the previous thread.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial",sans-serif;color:#222222;background:white">Thank you,</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">-- <u></u><u></u></p>
<div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Mikhail Ramalho.<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div>
</div>