From c23197a26f34f559ea9797de51e187087c039c42 Mon Sep 17 00:00:00 2001 From: Torok Edwin Date: Tue, 14 Jul 2009 16:55:14 +0000 Subject: llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable. This adds location info for all llvm_unreachable calls (which is a macro now) in !NDEBUG builds. In NDEBUG builds location info and the message is off (it only prints "UREACHABLE executed"). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/ErrorHandling.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'include/llvm/Support/ErrorHandling.h') diff --git a/include/llvm/Support/ErrorHandling.h b/include/llvm/Support/ErrorHandling.h index c14eed9885..bdee5b1c24 100644 --- a/include/llvm/Support/ErrorHandling.h +++ b/include/llvm/Support/ErrorHandling.h @@ -47,19 +47,20 @@ namespace llvm { void llvm_report_error(const std::string &reason) NORETURN; /// This function calls abort(), and prints the optional message to stderr. - /// Call this instead of assert(0), so that compiler knows the path is not - /// reachable even for NDEBUG builds. - /// Use the LLVM_UNREACHABLE macro instead that adds location info. - void llvm_unreachable(const char *msg=0, const char *file=0, - unsigned line=0) NORETURN; + /// Use the llvm_unreachable macro (that adds location info), instead of + /// calling this function directly. + void llvm_unreachable_internal(const char *msg=0, const char *file=0, + unsigned line=0) NORETURN; } -/// Macro that calls llvm_unreachable with location info and message in -/// debug mode. In NDEBUG mode it calls llvm_unreachable with no message. +/// Prints the message and location info to stderr in !NDEBUG builds. +/// In NDEBUG mode it only prints "UNREACHABLE executed". +/// Use this instead of assert(0), so that the compiler knows this path +/// is not reachable even for NDEBUG builds. #ifndef NDEBUG -#define LLVM_UNREACHABLE(msg) llvm_unreachable(msg, __FILE__, __LINE__) +#define llvm_unreachable(msg) llvm_unreachable_internal(msg, __FILE__, __LINE__) #else -#define LLVM_UNREACHABLE(msg) llvm_unreachable() +#define llvm_unreachable(msg) llvm_unreachable_internal() #endif #endif -- cgit v1.2.3