Normalize template specialization angle bracket spacing#55910
Closed
coado wants to merge 10 commits intofacebook:mainfrom
Closed
Normalize template specialization angle bracket spacing#55910coado wants to merge 10 commits intofacebook:mainfrom
coado wants to merge 10 commits intofacebook:mainfrom
Conversation
added 9 commits
March 5, 2026 01:49
Summary:
Doxygen incorrectly parses Objective-C interface declarations with protocol conformance. For example:
```objc
interface RCTAppearance : RCTEventEmitter <RCTBridgeModule>
```
Doxygen splits this into **two separate base classes** in the XML:
```xml
<basecompoundref>RCTEventEmitter</basecompoundref>
<basecompoundref><RCTBridgeModule></basecompoundref>
```
This caused the parser to output:
```
interface RCTAppearance : public RCTEventEmitter, public <RCTBridgeModule> {
```
Instead of the expected:
```
interface RCTAppearance : public RCTEventEmitter <RCTBridgeModule> {
```
The fix detects when a "base class" name starts and ends with `<...>` (indicating it's a protocol conformance) and combines it with the preceding actual base class name.
Differential Revision: D94351731
Summary: Doxygen splits block property types across `<type>` and `<argsstring>` elements. For example: ```objc property (nonatomic, copy) void (^eventInterceptor)(NSString *eventName, NSDictionary *event, NSNumber *reactTag); ``` Produces XML like: ```xml <type>void(^</type> <name>eventInterceptor</name> <argsstring>)(NSString *eventName, NSDictionary *event, NSNumber *reactTag)</argsstring> ``` This caused the parser to output incomplete types. The fix detects when the property type ends with `(^` and combines it with the property name and argsstring: ``` property (copy) void(^eventInterceptor)(NSString *eventName, NSDictionary *event, NSNumber *reactTag); ``` Differential Revision: D94366205 Reviewed By: cipolleschi
Summary: Set predefined `__deprecated_msg` to empty string in the `.doxygen.config.template` as doxygen has problem with parsing and produces malformed xml. Differential Revision: D94517576
Summary:
Adds a doxygen input filter (`input_filters/doxygen_strip_comments.py`) that strips block comments from source files before doxygen parses them.
This prevents doxygen from incorrectly parsing Objective-C code examples (like `interface`, `protocol`) within documentation comments as actual code declarations. For example, a doc comment containing:
```
/**
* Example:
* interface RCT_EXTERN_MODULE(MyModule, NSObject)
* end
*/
```
Was being parsed by doxygen as an actual interface declaration, resulting in malformed output like `interface RCT_EXTERN_MODULE {}` in the API snapshot.
The filter preserves line numbers by replacing comment content with the equivalent number of newlines, ensuring error messages remain accurate.
Differential Revision: D94534964
Summary:
Adds a doxygen input filter (`input_filters/doxygen_strip_comments.py`) that strips block comments from source files before doxygen parses them.
This prevents doxygen from incorrectly parsing Objective-C code examples (like `interface`, `protocol`) within documentation comments as actual code declarations. For example, a doc comment containing:
```
/**
* Example:
* interface RCT_EXTERN_MODULE(MyModule, NSObject)
* end
*/
```
Was being parsed by doxygen as an actual interface declaration, resulting in malformed output like `interface RCT_EXTERN_MODULE {}` in the API snapshot.
## Changes
1. **Input Filter**: Added `doxygen_strip_comments.py` that replaces block comments with equivalent newlines to preserve line numbers.
2. **Fixed Empty Snapshots**: Fixed the `__main__.py` to properly pass the `${DOXYGEN_INPUT_FILTER}` placeholder value to doxygen config, which was causing empty snapshot generation.
3. **Normalized Pointer Spacing**: Added `normalize_pointer_spacing()` function to normalize doxygen's output:
- `NSString *` → `NSString*`
- `int &` → `int&`
- `T &&` → `T&&`
4. **Added Snapshot Test**: Created `should_not_parse_interface_from_doc_comment` test case demonstrating the issue.
Differential Revision: D94538938
Summary: 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 Differential Revision: D95078214
Summary: Includes definitions behind the `__cplusplus` macro to also be visible in the API snapshot. Differential Revision: D95189538
Summary: Doxygen incorrectly merges category members into the base interface XML output. This causes duplicate members to appear in both the category scope and the interface scope. The fix detects category members by checking if their definition contains the pattern `ClassName(CategoryName)::` (e.g., `RCTBridgeProxy(Cxx)::cxxOnlyProperty`) and filters them out when processing interface sections. Differential Revision: D95191148
Summary: 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. Differential Revision: D95195669
coado
added a commit
to coado/react-native
that referenced
this pull request
Mar 5, 2026
Summary: Pull Request resolved: facebook#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
coado
added a commit
to coado/react-native
that referenced
this pull request
Mar 5, 2026
Summary: Pull Request resolved: facebook#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
Summary: Pull Request resolved: facebook#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
|
This pull request has been merged in dc8c442. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
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_bracketsto verify the fix.Changelog:
[Internal]
Reviewed By: cipolleschi
Differential Revision: D95204780