<div dir="ltr">How about<div><br></div><div>#else</div><div>#define LLVM_PRETTY_FUNCTION <font color="#2a2a2a" size="2">__func__</font></div><div><font color="#2a2a2a" size="2">#endif</font></div><div><font color="#2a2a2a" size="2"><br></font></div><div><font color="#2a2a2a" size="2">which is present in C99 and C++11?</font></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 9, 2016 at 3:23 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I am using this indeed for logging in LLDB, so getTypeName() won't work.  LLDB is using __PRETTY_FUNCTION__ and then for windows there is a line that says #define __PRETTY_FUNCTION __FUNCSIG__, but then non-Windows users have to remember to include an LLDB specific, windows-specific header which is frequently missed causing compiler breaks.  So llvm/Compiler.h seems like a logical place to put this.  A warning seems reasonable.</div><div><br></div><div><span style="line-height:1.5">The only user of this at the moment will be LLDB, and either __PRETTY_FUNCTION__ or __FUNCSIG__ has always worked on all compilers that LLDB supports, so nothing should break.</span><br></div><div><span style="line-height:1.5"><br></span></div><div><div>Do you know offhand which compilers support neither, and what is the appropriate thing to use in those cases?  getTypeName() seems to indicate that there may not be an equivalent, or at the very least that if there is an "equivalent", it's not very similar.</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 9, 2016 at 3:19 PM Justin Bogner <<a href="mailto:mail@justinbogner.com" target="_blank">mail@justinbogner.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Zachary Turner via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> writes:<br>
> Author: zturner<br>
> Date: Tue Aug  9 17:03:45 2016<br>
> New Revision: 278170<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=278170&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=278170&view=rev</a><br>
> Log:<br>
> Add a platform independent version of __PRETTY_FUNCTION__.<br>
><br>
> MSVC doesn't have this, it only has __FUNCSIG__.  So this adds<br>
> a new macro called LLVM_PRETTY_FUNCTION which evaluates to the<br>
> right thing on any platform.<br>
<br>
Depending what you're planning on using this for, you might be better off<br>
using llvm::getTypeName (include/llvm/Support/TypeName.h). See also the<br>
commit that added getTypeName for a number of caveats about trying to do<br>
this portably.<br>
<br>
Finally, this at the very least needs some big warnings about the fact<br>
that it isn't portable at all and is only suitable for things like<br>
logging. It also probably needs a third case for compilers that support<br>
neither FUNCSIG nor PRETTY_FUNCTION.<br>
<br>
> Modified:<br>
>     llvm/trunk/include/llvm/Support/Compiler.h<br>
><br>
> Modified: llvm/trunk/include/llvm/Support/Compiler.h<br>
> URL:<br>
> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=278170&r1=278169&r2=278170&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=278170&r1=278169&r2=278170&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/Support/Compiler.h (original)<br>
> +++ llvm/trunk/include/llvm/Support/Compiler.h Tue Aug  9 17:03:45 2016<br>
> @@ -453,6 +453,14 @@ void AnnotateIgnoreWritesEnd(const char<br>
>  #define LLVM_DUMP_METHOD LLVM_ATTRIBUTE_NOINLINE<br>
>  #endif<br>
><br>
> +/// \brief Gets a user-friendly looking function signature for the current scope<br>
> +/// using the best available method on each platform.<br>
> +#if defined(LLVM_ON_WIN32)<br>
> +#define LLVM_PRETTY_FUNCTION __FUNCSIG__<br>
> +#else<br>
> +#define LLVM_PRETTY_FUNCTION __PRETTY_FUNCTION__<br>
> +#endif<br>
> +<br>
>  /// \macro LLVM_THREAD_LOCAL<br>
>  /// \brief A thread-local storage specifier which can be used with globals,<br>
>  /// extern globals, and static globals.<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></blockquote></div>