[PATCH] D36826: Give guidance on report_fatal_error in CodingStandards.rst and ProgrammersManual.rst
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 17 22:30:38 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL311146: Give guidance on report_fatal_error in CodingStandards.rst and… (authored by asb).
Changed prior to commit:
https://reviews.llvm.org/D36826?vs=111504&id=111618#toc
Repository:
rL LLVM
https://reviews.llvm.org/D36826
Files:
llvm/trunk/docs/CodingStandards.rst
llvm/trunk/docs/ProgrammersManual.rst
Index: llvm/trunk/docs/CodingStandards.rst
===================================================================
--- llvm/trunk/docs/CodingStandards.rst
+++ llvm/trunk/docs/CodingStandards.rst
@@ -1232,6 +1232,11 @@
code for this branch. If the compiler does not support this, it will fall back
to the "abort" implementation.
+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
+recoverable error mechanism described in :doc:`ProgrammersManual` or
+``report_fatal_error`` should be used instead.
+
Another issue is that values used only by assertions will produce an "unused
value" warning when assertions are disabled. For example, this code will warn:
Index: llvm/trunk/docs/ProgrammersManual.rst
===================================================================
--- llvm/trunk/docs/ProgrammersManual.rst
+++ llvm/trunk/docs/ProgrammersManual.rst
@@ -441,6 +441,14 @@
as simple as reporting the issue to the user, or it may involve attempts at
recovery.
+.. note::
+
+ Ideally, the error handling approach described in this section would be
+ used throughout LLVM. However, this is not yet the case. For
+ non-programmatic errors where the ``Error`` scheme cannot easily be
+ applied, ``report_fatal_error`` should be used to call any installed error
+ handler and then terminate the program.
+
Recoverable errors are modeled using LLVM's ``Error`` scheme. This scheme
represents errors using function return values, similar to classic C integer
error codes, or C++'s ``std::error_code``. However, the ``Error`` class is
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36826.111618.patch
Type: text/x-patch
Size: 1649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170818/9404fe3b/attachment.bin>
More information about the llvm-commits
mailing list