[clang] f35f59a - Adding some documentation for __builtin_dump_struct.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 27 06:36:53 PST 2020


Author: Aaron Ballman
Date: 2020-02-27T09:30:17-05:00
New Revision: f35f59ac36db3c5fe636f6899d98ac690126a4f7

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

LOG: Adding some documentation for __builtin_dump_struct.

Added: 
    

Modified: 
    clang/docs/LanguageExtensions.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index a15bf50f7c08..4c7af39e93e2 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -1783,6 +1783,52 @@ controlled state.
 
 .. _langext-__builtin_shufflevector:
 
+``__builtin_dump_struct``
+-------------------------
+
+**Syntax**:
+
+.. code-block:: c++
+
+     __builtin_dump_struct(&some_struct, &some_printf_func);
+
+**Examples**:
+
+.. code-block:: c++
+
+     struct S {
+       int x, y;
+       float f;
+       struct T {
+         int i;
+       } t;
+     };
+
+     void func(struct S *s) {
+       __builtin_dump_struct(s, &printf);
+     }
+
+Example output:
+
+.. code-block:: none
+
+     struct S {
+     int i : 100
+     int j : 42
+     float f : 3.14159
+     struct T t : struct T {
+         int i : 1997
+         }
+     }
+
+**Description**:
+
+The '``__builtin_dump_struct``' function is used to print the fields of a simple
+structure and their values for debugging purposes. The builtin accepts a pointer
+to a structure to dump the fields of, and a pointer to a formatted output
+function whose signature must be: ``int (*)(const char *, ...)`` and must
+support the format specifiers used by ``printf()``.
+
 ``__builtin_shufflevector``
 ---------------------------
 


        


More information about the cfe-commits mailing list