Skip to content

Commit 44bb931

Browse files
j-piaseckimeta-codesync[bot]
authored andcommitted
Ignore anonymous variables in the snapshot (#55845)
Summary: Pull Request resolved: #55845 Changelog: [Internal] Updates C++ API snapshot generator not to include anonymous variables in the snapshot. This covers an edge case where doxygen will generate an anonymout member of type "union" when an anonymous union is present in a class. Reviewed By: cipolleschi Differential Revision: D94901506 fbshipit-source-id: cb02b3b80389fcf5a0ac20012e0897afc355cb57
1 parent 25ac11b commit 44bb931

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

scripts/cxx-api/parser/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,10 @@ def build_snapshot(xml_dir: str) -> Snapshot:
479479
member_def.get_type()
480480
)
481481

482+
# Skip anonymous variables
483+
if "@" in var_type:
484+
continue
485+
482486
if var_type == "friend":
483487
class_scope.add_member(
484488
FriendMember(
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
struct test::BundleHeader {
2+
public uint32_t magic32;
3+
public uint32_t version;
4+
public uint64_t magic64;
5+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
#pragma once
9+
10+
#include <cstdint>
11+
12+
namespace test {
13+
14+
struct BundleHeader {
15+
union {
16+
uint32_t magic32;
17+
uint64_t magic64;
18+
};
19+
uint32_t version;
20+
};
21+
22+
} // namespace test

0 commit comments

Comments
 (0)