summaryrefslogtreecommitdiff
path: root/docs/ProgrammersManual.rst
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
commit044eb2f6afba375a914ac9d8024f8f5142bb912e (patch)
tree1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /docs/ProgrammersManual.rst
parenteb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff)
Notes
Diffstat (limited to 'docs/ProgrammersManual.rst')
-rw-r--r--docs/ProgrammersManual.rst15
1 files changed, 12 insertions, 3 deletions
diff --git a/docs/ProgrammersManual.rst b/docs/ProgrammersManual.rst
index d115a9cf6de8..719d3997594e 100644
--- a/docs/ProgrammersManual.rst
+++ b/docs/ProgrammersManual.rst
@@ -441,6 +441,15 @@ the program where they can be handled appropriately. Handling the error may be
as simple as reporting the issue to the user, or it may involve attempts at
recovery.
+.. note::
+
+ While it would be ideal to use this error handling scheme throughout
+ LLVM, there are places where this hasn't been practical to apply. In
+ situations where you absolutely must emit a non-programmatic error and
+ the ``Error`` model isn't workable you can call ``report_fatal_error``,
+ which will call installed error handlers, print a message, and exit 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
@@ -486,7 +495,7 @@ that inherits from the ErrorInfo utility, E.g.:
Error printFormattedFile(StringRef Path) {
if (<check for valid format>)
- return make_error<InvalidObjectFile>(Path);
+ return make_error<BadFileFormat>(Path);
// print file contents.
return Error::success();
}
@@ -1224,7 +1233,7 @@ Define your DebugCounter like this:
.. code-block:: c++
DEBUG_COUNTER(DeleteAnInstruction, "passname-delete-instruction",
- "Controls which instructions get delete").
+ "Controls which instructions get delete");
The ``DEBUG_COUNTER`` macro defines a static variable, whose name
is specified by the first argument. The name of the counter
@@ -2105,7 +2114,7 @@ is stored in the same allocation as the Value of a pair).
StringMap also provides query methods that take byte ranges, so it only ever
copies a string if a value is inserted into the table.
-StringMap iteratation order, however, is not guaranteed to be deterministic, so
+StringMap iteration order, however, is not guaranteed to be deterministic, so
any uses which require that should instead use a std::map.
.. _dss_indexmap: