Make LLVM_PRETTY_FUNCTION support __func__.
authorZachary Turner <zturner@google.com>
Tue, 9 Aug 2016 23:03:55 +0000 (23:03 +0000)
committerZachary Turner <zturner@google.com>
Tue, 9 Aug 2016 23:03:55 +0000 (23:03 +0000)
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.

llvm-svn: 278176

llvm/include/llvm/Support/Compiler.h

index 92a712b..516691f 100644 (file)
@@ -453,12 +453,17 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
 #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