From cef001aaaa679665f9ca59873ca954c161f90ca5 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 9 Aug 2016 23:03:55 +0000 Subject: [PATCH] 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. llvm-svn: 278176 --- llvm/include/llvm/Support/Compiler.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index 92a712b..516691f 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -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 -- 2.7.4