================ @@ -3379,6 +3379,60 @@ 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. + +For example, consider the following code: + +.. code-block:: c++ + + void foo(int* p) { + if (p == nullptr) + __builtin_verbose_trap("Argument must not be null!"); + } + +The debugging information would look as if it were produced for the following code: + +.. code-block:: c++ + + __attribute__((always_inline)) + inline void "__llvm_verbose_trap: Argument must not be null!"() { + __builtin_trap(); + } + + void foo(int* p) { + if (p == nullptr) + "__llvm_verbose_trap: Argument must not be null!"(); + } + +However, the LLVM IR would not actually contain a call to the artificial ---------------- delcypher wrote:
```suggestion However, the generated code would not actually contain a call to the artificial ``` https://github.com/llvm/llvm-project/pull/79230 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits