diff options
author | Zachary Turner <zturner@google.com> | 2016-08-09 23:03:55 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-08-09 23:03:55 +0000 |
commit | cef001aaaa679665f9ca59873ca954c161f90ca5 (patch) | |
tree | c65b00f5cfd6e8409148ec51aa9aeaef89c3cd8f | |
parent | d403a3d8eef42e0af61cd37d4cb299235f3a26ca (diff) | |
download | bcm5719-llvm-cef001aaaa679665f9ca59873ca954c161f90ca5.tar.gz bcm5719-llvm-cef001aaaa679665f9ca59873ca954c161f90ca5.zip |
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
-rw-r--r-- | llvm/include/llvm/Support/Compiler.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index 92a712bcb52..516691f29de 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 |