aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support/ErrorHandling.h
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-03-14 22:41:50 +0000
committerJohn McCall <rjmccall@apple.com>2011-03-14 22:41:50 +0000
commitb121bfcc22660b1bdfb1183b191b6516988bcaf5 (patch)
tree7271b66182bd26528c3ea4a258986b4ed011f23c /include/llvm/Support/ErrorHandling.h
parent7d4fc4fb345ee8a1de15c718a854b5f38c1e6e46 (diff)
downloadexternal_llvm-b121bfcc22660b1bdfb1183b191b6516988bcaf5.tar.gz
external_llvm-b121bfcc22660b1bdfb1183b191b6516988bcaf5.tar.bz2
external_llvm-b121bfcc22660b1bdfb1183b191b6516988bcaf5.zip
Version N of the llvm_unreachable patch: VC++ doesn't recognize that abort()
doesn't return, so just go back to using the old runtime function instead of trying to use abort() when __builtin_unreachable (or an equivalent) isn't supported. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/ErrorHandling.h')
-rw-r--r--include/llvm/Support/ErrorHandling.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/include/llvm/Support/ErrorHandling.h b/include/llvm/Support/ErrorHandling.h
index fb0c88d8d8..95b01095c1 100644
--- a/include/llvm/Support/ErrorHandling.h
+++ b/include/llvm/Support/ErrorHandling.h
@@ -86,18 +86,21 @@ namespace llvm {
unsigned line=0);
}
-/// Prints the message and location info to stderr in !NDEBUG builds.
-/// This is intended to be used for "impossible" situations that imply
-/// a bug in the compiler.
+/// Marks that the current location is not supposed to be reachable.
+/// In !NDEBUG builds, prints the message and location info to stderr.
+/// In NDEBUG builds, becomes an optimizer hint that the current location
+/// is not supposed to be reachable. On compilers that don't support
+/// such hints, prints a reduced message instead.
///
-/// 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.
+/// Use this instead of assert(0). It conveys intent more clearly and
+/// allows compilers to omit some unnecessary code.
#ifndef NDEBUG
#define llvm_unreachable(msg) \
::llvm::llvm_unreachable_internal(msg, __FILE__, __LINE__)
-#else
+#elif defined(LLVM_BUILTIN_UNREACHABLE)
#define llvm_unreachable(msg) LLVM_BUILTIN_UNREACHABLE
+#else
+#define llvm_unreachable(msg) ::llvm::llvm_unreachable_internal()
#endif
#endif