Skip to content

Commit 562a455

Browse files
authored
[ProgrammersManual] Update report_fatal_error docs (#138502)
Update docs for #138251. Mention reportFatalInternalError and reportFatalUsageError in the respective sections of the documentation.
1 parent 3dc1f75 commit 562a455

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

llvm/docs/ProgrammersManual.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,15 @@ that should never be entered if the program invariants hold:
437437
llvm_unreachable("X should be Foo or Bar here");
438438
}
439439
440+
Additionally, ``reportFatalInternalError`` can be used to report invariant
441+
violations even in builds that do not enable assertions:
442+
443+
.. code-block:: c++
444+
445+
if (VerifyFooAnalysis && !Foo.verify()) {
446+
reportFatalInternalError("Analysis 'foo' not preserved");
447+
}
448+
440449
Recoverable Errors
441450
^^^^^^^^^^^^^^^^^^
442451

@@ -452,9 +461,9 @@ recovery.
452461
While it would be ideal to use this error handling scheme throughout
453462
LLVM, there are places where this hasn't been practical to apply. In
454463
situations where you absolutely must emit a non-programmatic error and
455-
the ``Error`` model isn't workable you can call ``report_fatal_error``,
456-
which will call installed error handlers, print a message, and abort the
457-
program. The use of `report_fatal_error` in this case is discouraged.
464+
the ``Error`` model isn't workable you can call ``reportFatalUsageError``,
465+
which will call installed error handlers, print a message, and exit the
466+
program. The use of `reportFatalUsageError` in this case is discouraged.
458467

459468
Recoverable errors are modeled using LLVM's ``Error`` scheme. This scheme
460469
represents errors using function return values, similar to classic C integer

0 commit comments

Comments
 (0)