[clang] 491984c - Document __builtin_trap and __builtin_debugtrap

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 5 00:11:31 PST 2022


Author: serge-sans-paille
Date: 2022-01-05T03:10:17-05:00
New Revision: 491984c4e60c0f0de9dd00dc1a19e90a7b3535eb

URL: https://github.com/llvm/llvm-project/commit/491984c4e60c0f0de9dd00dc1a19e90a7b3535eb
DIFF: https://github.com/llvm/llvm-project/commit/491984c4e60c0f0de9dd00dc1a19e90a7b3535eb.diff

LOG: Document __builtin_trap and __builtin_debugtrap

Differential Revision: https://reviews.llvm.org/D116598

Added: 
    

Modified: 
    clang/docs/LanguageExtensions.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index a47625e4a8dd2..a46edf6ca5061 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -2620,6 +2620,42 @@ argument.
   int *pb =__builtin_preserve_access_index(&v->c[3].b);
   __builtin_preserve_access_index(v->j);
 
+``__builtin_debugtrap``
+-----------------------
+
+``__builtin_debugtrap`` causes the program to stop its execution in such a way that a debugger can catch it.
+
+**Syntax**:
+
+.. code-block:: c++
+
+    __builtin_debugtrap()
+
+**Description**
+
+``__builtin_debugtrap`` is lowered to the ` ``llvm.debugtrap`` <https://llvm.org/docs/LangRef.html#llvm-debugtrap-intrinsic>`_ builtin. It should have the same effect as setting a breakpoint on the line where the builtin is called.
+
+Query for this feature with ``__has_builtin(__builtin_debugtrap)``.
+
+
+``__builtin_trap``
+------------------
+
+``__builtin_trap`` causes the program to stop its execution abnormally.
+
+**Syntax**:
+
+.. code-block:: c++
+
+    __builtin_trap()
+
+**Description**
+
+``__builtin_trap`` is lowered to the ` ``llvm.trap`` <https://llvm.org/docs/LangRef.html#llvm-trap-intrinsic>`_ builtin.
+
+Query for this feature with ``__has_builtin(__builtin_trap)``.
+
+
 ``__builtin_sycl_unique_stable_name``
 -------------------------------------
 


        


More information about the cfe-commits mailing list