[llvm] r278176 - Make LLVM_PRETTY_FUNCTION support __func__.

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


Author: zturner
Date: Tue Aug  9 18:03:55 2016
New Revision: 278176

URL: http://llvm.org/viewvc/llvm-project?rev=278176&view=rev
Log:
Make LLVM_PRETTY_FUNCTION support __func__.

In case there are compilers that support neither __FUNCSIG__ or
__PRETTY_FUNCTION__, we fall back to __func__ as a last resort,
which should be guaranteed by C++11 and C99.

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=278176&r1=278175&r2=278176&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Tue Aug  9 18:03:55 2016
@@ -453,12 +453,17 @@ void AnnotateIgnoreWritesEnd(const char
 #define LLVM_DUMP_METHOD LLVM_ATTRIBUTE_NOINLINE
 #endif
 
+/// \macro LLVM_PRETTY_FUNCTION
 /// \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)
+/// using the best available method on each platform.  The exact format of the
+/// resulting string is implementation specific and non-portable, so this should
+/// only be used, for example, for logging or diagnostics.
+#if defined(_MSC_VER)
 #define LLVM_PRETTY_FUNCTION __FUNCSIG__
-#else
+#elif defined(__GNUC__) || defined(__clang__)
 #define LLVM_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#else 
+#define LLVM_PRETTY_FUNCTION __func__
 #endif
 
 /// \macro LLVM_THREAD_LOCAL




More information about the llvm-commits mailing list