[llvm] r278170 - Add a platform independent version of __PRETTY_FUNCTION__.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 15:03:45 PDT 2016


Author: zturner
Date: Tue Aug  9 17:03:45 2016
New Revision: 278170

URL: http://llvm.org/viewvc/llvm-project?rev=278170&view=rev
Log:
Add a platform independent version of __PRETTY_FUNCTION__.

MSVC doesn't have this, it only has __FUNCSIG__.  So this adds
a new macro called LLVM_PRETTY_FUNCTION which evaluates to the
right thing on any platform.

Modified:
    llvm/trunk/include/llvm/Support/Compiler.h

Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=278170&r1=278169&r2=278170&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Tue Aug  9 17:03:45 2016
@@ -453,6 +453,14 @@ void AnnotateIgnoreWritesEnd(const char
 #define LLVM_DUMP_METHOD LLVM_ATTRIBUTE_NOINLINE
 #endif
 
+/// \brief Gets a user-friendly looking function signature for the current scope
+/// using the best available method on each platform.
+#if defined(LLVM_ON_WIN32)
+#define LLVM_PRETTY_FUNCTION __FUNCSIG__
+#else
+#define LLVM_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#endif
+
 /// \macro LLVM_THREAD_LOCAL
 /// \brief A thread-local storage specifier which can be used with globals,
 /// extern globals, and static globals.




More information about the llvm-commits mailing list