Skip to content

Commit 05d3376

Browse files
Dawid Małeckimeta-codesync[bot]
authored andcommitted
Split of "[RN][C++ Stable API] Add template normalizing"
1 parent 1c5ec5e commit 05d3376

5 files changed

Lines changed: 77 additions & 6 deletions

File tree

scripts/cxx-api/parser/builders.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,7 @@
2626
TypedefMember,
2727
VariableMember,
2828
)
29-
from .scope import (
30-
CategoryScopeKind,
31-
InterfaceScopeKind,
32-
ProtocolScopeKind,
33-
StructLikeScopeKind,
34-
)
29+
from .scope import InterfaceScopeKind, ProtocolScopeKind, StructLikeScopeKind
3530
from .snapshot import Snapshot
3631
from .template import Template
3732
from .utils import (
@@ -358,6 +353,17 @@ def get_property_member(
358353
# Scope creation
359354
######################
360355

356+
# Interfaces to skip due to Doxygen misparsing issues.
357+
# These produce malformed XML that cannot be reliably reconstructed.
358+
SKIP_INTERFACES = {
359+
# Doxygen misparses Objective-C lightweight generics like @interface Foo<T> : NSObject.
360+
# It places <T> in the base class list and corrupts subsequent declarations.
361+
"RCTGenericDelegateSplitter",
362+
# Multi-line interface declarations cause Doxygen to misparse inheritance.
363+
# @interface Foo\n : Bar <Protocol> results in __pad0__ and lost base classes.
364+
"RCTScrollViewComponentView",
365+
}
366+
361367

362368
def create_enum_scope(snapshot: Snapshot, enum_def: compound.EnumdefType) -> None:
363369
"""
@@ -469,6 +475,9 @@ def create_interface_scope(
469475
"""
470476
interface_name = scope_def.compoundname
471477

478+
if interface_name in SKIP_INTERFACES:
479+
return
480+
472481
interface_scope = snapshot.create_interface(interface_name)
473482
base_classes = get_base_classes(scope_def, base_class=InterfaceScopeKind.Base)
474483
interface_scope.kind.add_base(base_classes)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
/**
9+
* Test case for Objective-C interface with generic type parameters.
10+
*
11+
* Doxygen 1.11.0 misparses Objective-C lightweight generics, placing
12+
* <DelegateT> in the base class list and corrupting subsequent declarations.
13+
*
14+
* This interface is SKIPPED in the parser output due to malformed Doxygen XML.
15+
* See SKIP_INTERFACES in builders.py.
16+
*/
17+
@interface RCTGenericDelegateSplitter<DelegateT> : NSObject
18+
19+
@property (nonatomic, copy, nullable) void (^delegateUpdateBlock)(DelegateT _Nullable delegate);
20+
21+
- (instancetype)initWithDelegateUpdateBlock:(void (^)(DelegateT _Nullable delegate))block;
22+
- (void)addDelegate:(DelegateT)delegate;
23+
- (void)removeDelegate:(DelegateT)delegate;
24+
- (void)removeAllDelegates;
25+
26+
@end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
protocol RCTMountingTransactionObserving {
2+
}
3+
4+
protocol RCTVirtualViewContainerProtocol {
5+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
@protocol RCTMountingTransactionObserving
9+
@end
10+
11+
@protocol RCTVirtualViewContainerProtocol
12+
@end
13+
14+
@class RCTViewComponentView;
15+
16+
/**
17+
* Test case for multi-line Objective-C interface declarations.
18+
*
19+
* Doxygen misparses interface declarations that span multiple lines,
20+
* creating __pad0__ members and losing inheritance information.
21+
*
22+
* This interface is SKIPPED in the parser output due to malformed Doxygen XML.
23+
* See SKIP_INTERFACES in builders.py.
24+
*/
25+
@interface RCTScrollViewComponentView
26+
: RCTViewComponentView <RCTMountingTransactionObserving, RCTVirtualViewContainerProtocol>
27+
28+
+ (nullable RCTScrollViewComponentView *)findScrollViewComponentViewForView:(UIView *)view;
29+
30+
@end

0 commit comments

Comments
 (0)