[clang] Add support for builtin_verbose_trap (PR #79230)

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 1 14:10:19 PST 2024


================
@@ -3379,6 +3379,57 @@ Query for this feature with ``__has_builtin(__builtin_debugtrap)``.
 
 Query for this feature with ``__has_builtin(__builtin_trap)``.
 
+``__builtin_verbose_trap``
+--------------------------
+
+``__builtin_verbose_trap`` causes the program to stop its execution abnormally
+and shows a human-readable description of the reason for the termination when a
+debugger is attached or in a symbolicated crash log.
+
+**Syntax**:
+
+.. code-block:: c++
+
+    __builtin_verbose_trap(const char *reason)
+
+**Description**
+
+``__builtin_verbose_trap`` is lowered to the ` ``llvm.trap`` <https://llvm.org/docs/LangRef.html#llvm-trap-intrinsic>`_ builtin.
+Additionally, clang emits debugging information that represents an artificial
+inline frame whose name encodes the string passed to the builtin, prefixed by a
+"magic" prefix.
----------------
delcypher wrote:

This documentation doesn't say anything about whether or not Clang will merge traps (either with the same reason or different reasons). Should it?

https://github.com/llvm/llvm-project/pull/79230


More information about the cfe-commits mailing list