18 Commits
Author SHA1 Message Date
Jakub Piasecki 31f262ed2e Fix function pointer param args being qualified to outer class (#56217)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56217

Changelog: [Internal]

Doxygen may incorrectly cross-reference parameter names inside function
pointer types to member variables of the enclosing class. For example,
`void (*cb)(const void* data)` inside a class that has a `data` member
would produce `const void* Class::data` instead of
`const void* data` in the snapshot. This diff addresses two issues:

1. In `get_doxygen_params`, re-parse function pointer type strings
   through `parse_type_with_argstrings` which delegates to
   `_parse_single_argument` that already strips "::" from parameter
   names.
2. In `parse_type_with_argstrings`, recognize complex declarator groups
   starting with `*` or `&` (e.g. `*(*fp)(int)`) as non-argument-list
   parenthesized sections, preventing incorrect name extraction from
   nested function pointer declarators.

Reviewed By: cipolleschi

Differential Revision: D98118629

fbshipit-source-id: a8532e2adaec1dd2b50be8a20eae1068ac49d548
2026-03-26 08:40:54 -07:00
Dawid Małecki 4aacd3f2be Change doxygen template decoding to use a dictionary (#56087)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56087

Changelog: [Internal]

Replaces the chain of `replace` calls with a dict containing relevant mappings.

Reviewed By: cipolleschi

Differential Revision: D96455803

fbshipit-source-id: adaf8bcd84ae091841797af243e90dec664be09f
2026-03-18 09:29:02 -07:00
Dawid Małecki 78a7718d6c Extract member specializations from name (#56076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56076

Changelog: [Internal]

Updates the C++ API snapshot generator to extract specializations from name when a member is created, instead of relying on the one stored in the name string.

It also makes out-of-class definitions of members to be skipped in the snapshot as those were essentially duplicated between their declaration inside the class, and the initialization outside of it.

Reviewed By: cipolleschi

Differential Revision: D96303740

fbshipit-source-id: d649cb04bd7370af55ce707d607a372d7b4115b4
2026-03-18 09:29:02 -07:00
Dawid Małecki 140509f7d4 Extract class specializations from name (#56075)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56075

Changelog: [Internal]

Updates the parser to extract the template specializations from name string in order to avoid repeated operations on the name string.

Reviewed By: cipolleschi

Differential Revision: D96303732

fbshipit-source-id: 08ff8ba34522426adccd53129590c5a7d59e0438
2026-03-18 09:29:02 -07:00
Jakub Piasecki 94f40e7591 Strip leading :: for globally qualified identifiers (#56033)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56033

Changelog: [Internal]

Currently, if the source code uses globally qualified identifiers, those will be kept in the snapshot without changes. Since in the output, everything is fully qualified, the leading `::` can be stripped from those.

Reviewed By: cortinico

Differential Revision: D95947334

fbshipit-source-id: 9592b00bd896679dda90ed56d32024b22752d2b7
2026-03-11 00:17:04 -07:00
Jakub Piasecki 41a1941961 Remove incorrect qualification from function parameters (#55971)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55971

Changelog: [Internal]

Doxygen incorrectly transforms parameter names to references if they match a member. This diff strips the resulting invalid qualification from the type.

Reviewed By: cipolleschi

Differential Revision: D95548542

fbshipit-source-id: c1e475f10e07af6a4076336cab0d3cbe0da342e5
2026-03-08 23:52:42 -07:00
Jakub Piasecki c0f2f63ce1 Qualify identifiers in template specializations (#55929)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55929

Changelog: [Internal]

Adds support for identifier qualification when using template specializations and when inheriting from template objects.

Reviewed By: cortinico

Differential Revision: D95367957

fbshipit-source-id: 60f7057e3fa1c5fbc117ff03a50de43c2f0dc371
2026-03-06 06:54:33 -08:00
Dawid Małecki dc8c442aa5 Normalize template specialization angle bracket spacing (#55910)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55910

Normalizes angle bracket spacing in scope names for template specializations.

Doxygen encodes template specializations with spaces around angle brackets in compound names (e.g., `CSSDataTypeParser< CSSMatrix >`). This caused inconsistent output in API snapshots.

The fix applies `normalize_angle_brackets()` to qualified paths when parsing scope names, ensuring consistent output:
- `CSSDataTypeParser< CSSMatrix >` → `CSSDataTypeParser<CSSMatrix>`
- `Callback< R(Args...)>` → `Callback<R(Args...)>`

Added a new test case `should_normalize_template_specialization_angle_brackets` to verify the fix.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D95204780

fbshipit-source-id: d0d5fe7759a414b32630647f334b39e26da15108
2026-03-05 07:21:42 -08:00
Dawid Małecki 78c8842f9e Normalize Objective-C nullability annotations (#55898)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55898

Normalize Objective-C nullability annotations in the cxx-api parser to ensure consistent output in API snapshots.

Objective-C has three different forms of nullability annotations that are semantically equivalent:
- `nonnull`/`nullable` (context-sensitive keywords)
- `_Nonnull`/`_Nullable` (type qualifiers)
- `__nonnull`/`__nullable` (legacy Apple macros)

This diff normalizes all forms to `_Nonnull`/`_Nullable` for consistency.

**Examples:**
- `nonnull NSString*` → `_Nonnull NSString*`
- `NSString* __nonnull` → `NSString* _Nonnull`
- `nullable id` → `_Nullable id`
- `id __nullable` → `id _Nullable`
- `NSString* _Nonnull` → `NSString* _Nonnull` (unchanged)

Added a test case to verify the normalization works correctly.

Changelog:
[Internal]

Reviewed By: cortinico

Differential Revision: D95195669

fbshipit-source-id: ca2afd14b3c8bf7e62864daf9c3848f5d713898e
2026-03-05 07:21:42 -08:00
Dawid Małecki f2ea073857 Normalize pointer and reference spacing in parser output (#55901)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55901

Fixes inconsistent spacing around pointer (`*`) and reference (`&`, `&&`) symbols in the parser output.

Doxygen outputs types with a space before `*` and `&` (e.g., `NSString *`), which is inconsistent. This diff adds `normalize_pointer_spacing()` to standardize the output:

- `NSString *` → `NSString*`
- `int &` → `int&`
- `T &&` → `T&&`
- For function arguments: `NSString *name` → `NSString* name`

## Changes

1. Added `normalize_pointer_spacing()` function in `text_resolution.py`
2. Applied normalization in `resolve_ref_text_name()` and `resolve_linked_text_name()`
3. Applied normalization to block property argsstrings in `builders.py`
4. Updated all affected snapshot files to use normalized spacing

Changelog:
[Internal]

Reviewed By: cortinico

Differential Revision: D95078214

fbshipit-source-id: 1a21361565fd7915a3a597ac729cecc2cfe99961
2026-03-05 07:21:42 -08:00
Jakub Piasecki 84410fe330 Restore a single method for text parsing (#55909)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55909

Changelog: [Internal]

Restores the single path for doxygen ref parsing that was lost in refactor in D94072940

Reviewed By: cipolleschi

Differential Revision: D95206764

fbshipit-source-id: c2028872d8ff904187b41baf113dfe828796edcc
2026-03-04 23:54:39 -08:00
Dawid Małecki 4f38bed192 Add template normalizing (#55774)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55774

Doxygen adds spaces inside angle brackets in its XML output:
- Outputs: `std::vector< PropNameID >`
- Expected: `std::vector<PropNameID>`

Applying `normalize_angle_brackets()` in `resolve_ref_text_name()` to normalize spacing consistently.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D94232505

fbshipit-source-id: b0edc597d121cf875e74aad8a29514b52116567d
2026-03-04 04:39:21 -08:00
Dawid Małecki 851e5ae546 Parser refactor (#55772)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55772

The `main.py` increases rapidly in size. This diff refactors that into the `utils.py` and `builder.py` to form more modularized and easier to read structure.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D94072940

fbshipit-source-id: f4b7b3c3bf4e2cf387829ced039d5645e2ad4b3e
2026-03-04 01:55:35 -08:00
Dawid Małecki 16202980ed Add support for parsing protocols (#55766)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55766

This diff adds support for parsing Objective-C protocols in the C++ API snapshot parser. The angle bracket normalization is also added to ensure better snapshot structure.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D93859440

fbshipit-source-id: 21c4a47e33df0c61e738e07c5b56cfccd56af1a4
2026-03-03 07:45:45 -08:00
Jakub Piasecki 11072438f1 Don't requalify already globally qualified identifiers (#55847)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55847

Changelog: [Internal]

Disables name qualification on already globally qualified identifiers.

Reviewed By: cortinico

Differential Revision: D94901503

fbshipit-source-id: 22206b454c37e7e061abf34d64839f79c82eea1f
2026-03-03 01:00:16 -08:00
Jakub Piasecki 4683e006f5 Explicitly handle friend clasess (#55843)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55843

Changelog: [Internal]

Adds explicit support for friend classes in the C++ API snapshot. Doxygen treats friends as variables of type "friend". For the snapshot use case, we cover that special case and store them as explicit `FriendMember`. This allows for correctly ignoring friend definitions when qualifying identifiers.

Reviewed By: cipolleschi

Differential Revision: D94901510

fbshipit-source-id: fd2f8d7798eee2bfb5778a0969cf77d20d9978a7
2026-03-03 01:00:16 -08:00
Jakub Piasecki f013533487 Qualify type arguments based on scope context (#55697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55697

Changelog: [Internal]

Implements fallback name qualification for cases where doxygen doesn't extract the full qualified name, and instead passes on the string it found in the header file.

- Adds type_qualification.py with qualify_type_str(), qualify_arguments(), and qualify_parsed_type()
- Updates member.py with close() methods for VariableMember, FunctionMember, and TypedefMember to apply type qualification
- Updates main.py with get_doxygen_params() to extract structured parameter info

Reviewed By: cipolleschi

Differential Revision: D94077825

fbshipit-source-id: 2265f5573164af1af129014082fc44fb8fceb135
2026-02-25 11:16:36 -08:00
Jakub Piasecki 357dd6b3ec Reorganize utils and add generalize type string parsing (#55698)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55698

Changelog: [Internal]

Refactors utils.py into a proper package structure and adds comprehensive argument string parsing utilities.

- Converts utils.py to utils/ package with submodules
- Adds argument_parsing.py with parse_arg_string() and related utilities
- Adds qualified_path.py with parse_qualified_path moved from old utils.py
- Renames test_member.py to test_parse_arg_string.py with updated tests for the new 4-tuple Argument format

Reviewed By: cipolleschi

Differential Revision: D94077819

fbshipit-source-id: 460d7a44e6d3e55580d996877ca63fa0c777bc23
2026-02-25 11:16:36 -08:00