commit e7dc9f5fc8e0be46e90e97525f68fb3b3664b6b8
parent 1c69bf6ac2d8406db3127cb7364beae98f4fe26d
Author: Tooru Fujisawa <arai_a@mac.com>
Date: Tue, 6 Jan 2026 02:26:29 +0000
Bug 2002872 - Part 7: Document the class field layout. r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D277694
Diffstat:
4 files changed, 78 insertions(+), 5 deletions(-)
diff --git a/docs/contributing/searchfox.rst b/docs/contributing/searchfox.rst
@@ -13,6 +13,7 @@ Searchfox
searchfox/navigation_panel
searchfox/blame
searchfox/diagramming
+ searchfox/class_field_layout
searchfox/backend
Repositories
diff --git a/docs/contributing/searchfox/class_field_layout.rst b/docs/contributing/searchfox/class_field_layout.rst
@@ -0,0 +1,75 @@
+.. _searchfox_field_layout:
+
+==================
+Class field layout
+==================
+
+The class field layout table shows the layout of a class or struct,
+including inherited members, and holes.
+
+The table reflects multiple build configurations and the platforms.
+
+If the layout differs between them, for example with the following reasons, a row is created for each group.
+ - Debug-only fields
+ - Pointer size difference between platforms
+
+**Enabling Class field layout**: To use class field layout features, visit the
+`settings page <https://searchfox.org/mozilla-central/pages/settings.html>`_ and
+change the "Default feature gate" from "Release" to "Alpha", or use the
+"Semantic Info Queries gate" setting.
+
+
+.. image:: img/field-layout.png
+ :class: border
+ :alt: Class field layout table
+ :width: 800px
+
+Context Menu
+------------
+
+.. image:: img/context-menu-layout.png
+ :class: border
+ :alt: The context menu for classes
+ :width: 448px
+
+Class layout of ...
+ Open the class field layout table of given class.
+
+Controls
+--------
+
+Use Ascending Order/Use Descending Order
+ Order the classes in the ascending/descending order of the offset.
+
+ By default, descending order is used, and thus the specified class is shown in the top,
+ and the base classes are shown below it.
+
+ Choosing the ascending order makes the all fields orderedby the field offset.
+
+Columns
+ Select the columns to show.
+
+ Corresponds to the `show-cols:LIST` parameter.
+
+ Name
+ The name of the field.
+
+ Type
+ The actual type of the field.
+
+ Line
+ The actual line that declares the field.
+ This can be a macro invocation.
+
+
+Queries
+-------
+
+Show the class field layout table of given a class or struct.
+
+::
+
+ field-layout:'nsTString'
+
+https://searchfox.org/mozilla-central/query/default?q=field-layout%3A%27nsTString%27
+
diff --git a/docs/contributing/searchfox/context_menu.rst b/docs/contributing/searchfox/context_menu.rst
@@ -88,15 +88,12 @@ Expansion on ...
Class field layout
------------------
+See :ref:`class field layout <searchfox_field_layout>` document for more details..
+
For C++ classes, Searchfox can show the field layout table for each compilation target.
This is behind the alpha feature gate "Semantic Info Queries".
-.. image:: img/context-menu-layout.png
- :class: border
- :alt: The context menu for classes
- :width: 448px
-
Class layout of ...
Open the class field layout table of given class.
diff --git a/docs/contributing/searchfox/img/field-layout.png b/docs/contributing/searchfox/img/field-layout.png
Binary files differ.