Skip to content

Extend CPP API checker with further cases#763

Draft
castler wants to merge 2 commits into
mainfrom
js_extend_cpp_api_checker
Draft

Extend CPP API checker with further cases#763
castler wants to merge 2 commits into
mainfrom
js_extend_cpp_api_checker

Conversation

@castler

@castler castler commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

No description provided.

castler and others added 2 commits July 24, 2026 13:36
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant