[llvm] 562a455 - [ProgrammersManual] Update report_fatal_error docs (#138502)

via llvm-commits llvm-commits at lists.llvm.org
Tue May 6 00:58:13 PDT 2025


Author: Nikita Popov
Date: 2025-05-06T09:58:10+02:00
New Revision: 562a4559ee9b637714485169102f7a2600aab008

URL: https://github.com/llvm/llvm-project/commit/562a4559ee9b637714485169102f7a2600aab008
DIFF: https://github.com/llvm/llvm-project/commit/562a4559ee9b637714485169102f7a2600aab008.diff

LOG: [ProgrammersManual] Update report_fatal_error docs (#138502)

Update docs for https://github.com/llvm/llvm-project/pull/138251.
Mention reportFatalInternalError and reportFatalUsageError in the
respective sections of the documentation.

Added: 
    

Modified: 
    llvm/docs/ProgrammersManual.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst
index bb729597cc5a3..d417de73d0590 100644
--- a/llvm/docs/ProgrammersManual.rst
+++ b/llvm/docs/ProgrammersManual.rst
@@ -437,6 +437,15 @@ that should never be entered if the program invariants hold:
       llvm_unreachable("X should be Foo or Bar here");
   }
 
+Additionally, ``reportFatalInternalError`` can be used to report invariant
+violations even in builds that do not enable assertions:
+
+.. code-block:: c++
+
+  if (VerifyFooAnalysis && !Foo.verify()) {
+    reportFatalInternalError("Analysis 'foo' not preserved");
+  }
+
 Recoverable Errors
 ^^^^^^^^^^^^^^^^^^
 
@@ -452,9 +461,9 @@ recovery.
    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 abort the
-   program. The use of `report_fatal_error` in this case is discouraged.
+   the ``Error`` model isn't workable you can call ``reportFatalUsageError``,
+   which will call installed error handlers, print a message, and exit the
+   program. The use of `reportFatalUsageError` in this case is discouraged.
 
 Recoverable errors are modeled using LLVM's ``Error`` scheme. This scheme
 represents errors using function return values, similar to classic C integer


        


More information about the llvm-commits mailing list