Skip to content

Commit 25ac11b

Browse files
j-piaseckimeta-codesync[bot]
authored andcommitted
Ignore anonymous namespaces in the snapshot (#55844)
Summary: Pull Request resolved: #55844 Changelog: [Internal] Updates the C++ API snapshot generator not to include anonymous namespaces in the snapshot since those have internal linkage. Reviewed By: cipolleschi Differential Revision: D94901508 fbshipit-source-id: f025f69e4d9cc6cc42fa99974d596eb223e8da1c
1 parent 4683e00 commit 25ac11b

3 files changed

Lines changed: 32 additions & 0 deletions

File tree

scripts/cxx-api/parser/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,11 @@ def build_snapshot(xml_dir: str) -> Snapshot:
526526
f"Unknown class visibility: {visibility} in {compound_object.location.file}"
527527
)
528528
elif compound_object.kind == "namespace":
529+
# Skip anonymous namespaces (internal linkage, not public API).
530+
# Doxygen encodes them with a '@' prefix in the compound name.
531+
if "@" in compound_object.compoundname:
532+
continue
533+
529534
namespace_scope = snapshot.create_or_get_namespace(
530535
compound_object.compoundname
531536
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class test::Clss {
2+
public void hello();
3+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
namespace {
11+
enum class InternalEnum {
12+
A,
13+
B,
14+
};
15+
} // namespace
16+
17+
namespace test {
18+
19+
class Clss {
20+
public:
21+
void hello();
22+
};
23+
24+
} // namespace test

0 commit comments

Comments
 (0)