[llvm] 5f5d972 - [docs] Fix self-contradictory description of llvm_unreachable
Jan Korous via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 4 11:15:38 PDT 2020
Author: Jan Korous
Date: 2020-06-04T11:15:20-07:00
New Revision: 5f5d972d83ee80e9c319b61ee6a4b4704f4557dc
URL: https://github.com/llvm/llvm-project/commit/5f5d972d83ee80e9c319b61ee6a4b4704f4557dc
DIFF: https://github.com/llvm/llvm-project/commit/5f5d972d83ee80e9c319b61ee6a4b4704f4557dc.diff
LOG: [docs] Fix self-contradictory description of llvm_unreachable
Just two paragraphs above it says:
"If the compiler does not support this [skipping code generation for a particular branch], it will fall back
to the "abort" implementation."
And that actually correctly describes llvm_unreachable implementation.
Differential Revision: https://reviews.llvm.org/D81130
Added:
Modified:
llvm/docs/CodingStandards.rst
llvm/include/llvm/Support/ErrorHandling.h
Removed:
################################################################################
diff --git a/llvm/docs/CodingStandards.rst b/llvm/docs/CodingStandards.rst
index 15483e5d2798..767636531215 100644
--- a/llvm/docs/CodingStandards.rst
+++ b/llvm/docs/CodingStandards.rst
@@ -1200,8 +1200,7 @@ unconditionally a bug (not originating from user input; see below) of some kind.
Use of ``assert`` should always include a testable predicate (as opposed to
``assert(false)``).
-Neither assertions or ``llvm_unreachable`` will abort the program on a release
-build. If the error condition can be triggered by user input then the
+If the error condition can be triggered by user input then the
recoverable error mechanism described in :doc:`ProgrammersManual` should be
used instead. In cases where this is not practical, ``report_fatal_error`` may
be used.
diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 7678d8d6ba91..b4626facd22c 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -127,7 +127,7 @@ llvm_unreachable_internal(const char *msg = nullptr, const char *file = nullptr,
/// 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.
+/// such hints, prints a reduced message instead and aborts the program.
///
/// Use this instead of assert(0). It conveys intent more clearly and
/// allows compilers to omit some unnecessary code.
More information about the llvm-commits
mailing list