Extend CPP API checker with further cases#763
Draft
castler wants to merge 2 commits into
Draft
Conversation
castler
force-pushed
the
js_extend_cpp_api_checker
branch
from
July 24, 2026 10:53
9d68a2b to
1ded73b
Compare
Extend the public API extractor to correctly represent C++ constructs that were previously ignored or not reflected in the extracted signature, so that changing them is detected as an API change. - Signature enrichment: capture constexpr, extern / extern "C" linkage, and C++ standard attributes ([[nodiscard]], [[deprecated]], ...) into the signature. - Protected members are now part of the API surface, tagged with a protected_ kind prefix so public vs protected is distinguishable. The alias-flattening path stays public-only to preserve existing behavior. - Forward-declared / incomplete types (pimpl) are tracked as forward_class, only when no complete definition of the same qualified name exists. - extern "C" symbols are handled via LinkageSpecDecl propagation. - Explicit extern template instantiations are emitted as extern_template, including their template arguments (e.g. test::Array<int>). Ref-qualified overloads (&/&&) and return-type SFINAE (std::enable_if_t) are already carried through clang's qualType and are now covered by tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add one test scenario per newly-supported C++ construct, following the existing per-scenario pattern (header + golden lock file + BUILD cc_library/api_surface_test/api_surface_update + assertions in both the local clang-driven suite and the Bazel validation suite). New cases: - multi_inheritance: multiple public bases contribute members; private and protected bases do not. - ref_qualifiers: & / && overloads are distinct symbols. - member_function_templates: member function templates extracted. - globals: namespace-scope variables (constexpr / extern / plain) and free functions. - protected_methods: protected members tagged with protected_ kind. - constexpr_members: constexpr functions and (static) constexpr members. - forward_declared: forward-declared / incomplete pimpl types. - extern_c: extern "C" linkage captured in the signature. - extern_explicit: explicit extern template instantiations and extern globals. - cpp_attributes: [[nodiscard]] / [[deprecated]] captured. - sfinae: std::enable_if_t constraints captured in the signature. All 72 local unittest cases and 20 Bazel test targets pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.