diff --git a/scripts/cxx-api/parser/main.py b/scripts/cxx-api/parser/main.py index 69ff461bfdf..394ecb7027a 100644 --- a/scripts/cxx-api/parser/main.py +++ b/scripts/cxx-api/parser/main.py @@ -479,6 +479,10 @@ def build_snapshot(xml_dir: str) -> Snapshot: member_def.get_type() ) + # Skip anonymous variables + if "@" in var_type: + continue + if var_type == "friend": class_scope.add_member( FriendMember( diff --git a/scripts/cxx-api/tests/snapshots/should_skip_anonymous_variables/snapshot.api b/scripts/cxx-api/tests/snapshots/should_skip_anonymous_variables/snapshot.api new file mode 100644 index 00000000000..3ed3d0eadab --- /dev/null +++ b/scripts/cxx-api/tests/snapshots/should_skip_anonymous_variables/snapshot.api @@ -0,0 +1,5 @@ +struct test::BundleHeader { + public uint32_t magic32; + public uint32_t version; + public uint64_t magic64; +} diff --git a/scripts/cxx-api/tests/snapshots/should_skip_anonymous_variables/test.h b/scripts/cxx-api/tests/snapshots/should_skip_anonymous_variables/test.h new file mode 100644 index 00000000000..e987e08cbdf --- /dev/null +++ b/scripts/cxx-api/tests/snapshots/should_skip_anonymous_variables/test.h @@ -0,0 +1,22 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace test { + +struct BundleHeader { + union { + uint32_t magic32; + uint64_t magic64; + }; + uint32_t version; +}; + +} // namespace test