diff --git a/scripts/cxx-api/config.yml b/scripts/cxx-api/config.yml index 65ceefb0022..78a1f74a985 100644 --- a/scripts/cxx-api/config.yml +++ b/scripts/cxx-api/config.yml @@ -61,6 +61,7 @@ ReactApple: - "*/platform/macos/*" - "*/platform/android/*" definitions: + __cplusplus: 1 variants: debug: definitions: diff --git a/scripts/cxx-api/tests/snapshots/.doxygen.config.template b/scripts/cxx-api/tests/snapshots/.doxygen.config.template index f5f56836001..00ae22eb9d2 100644 --- a/scripts/cxx-api/tests/snapshots/.doxygen.config.template +++ b/scripts/cxx-api/tests/snapshots/.doxygen.config.template @@ -2442,7 +2442,8 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = FOLLY_PACK_PUSH="" \ +PREDEFINED = __cplusplus=1 \ + FOLLY_PACK_PUSH="" \ FOLLY_PACK_POP="" \ FOLLY_PACK_ATTR="" \ __attribute__(x)="" \ diff --git a/scripts/cxx-api/tests/snapshots/should_handle_ifdef_cplusplus/snapshot.api b/scripts/cxx-api/tests/snapshots/should_handle_ifdef_cplusplus/snapshot.api new file mode 100644 index 00000000000..eb5f4fcd4d9 --- /dev/null +++ b/scripts/cxx-api/tests/snapshots/should_handle_ifdef_cplusplus/snapshot.api @@ -0,0 +1,7 @@ +category RCTBridgeProxy(Cxx) { + public @property (assign) int cxxOnlyProperty; +} + +interface RCTBridgeProxy : public NSObject { + public @property (assign) int cxxOnlyProperty; +} diff --git a/scripts/cxx-api/tests/snapshots/should_handle_ifdef_cplusplus/test.h b/scripts/cxx-api/tests/snapshots/should_handle_ifdef_cplusplus/test.h new file mode 100644 index 00000000000..fe2a5d4afcc --- /dev/null +++ b/scripts/cxx-api/tests/snapshots/should_handle_ifdef_cplusplus/test.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +@interface RCTBridgeProxy : NSObject + +@end + +@interface RCTBridgeProxy (Cxx) + +#ifdef __cplusplus +@property (nonatomic, readwrite) int cxxOnlyProperty; +#endif + +@end