Skip to content

Track callable and pointer flow through nested standard containers - #301

Merged
DrSergei merged 1 commit into
masterfrom
feat/nested-container-flow
Nov 30, 2026
Merged

DrSergei merged 1 commit into
masterfrom
feat/nested-container-flow

Conversation

@DrSergei

Copy link
Copy Markdown
Member

Model a container element that is itself a modeled container with a nested owner keyed by the parent owner and a canonical inner specialization identity. Named inner containers copy their element cell and matching descendant cells into the nested chain; omitted template defaults are filled before comparison, so aliases and explicit default allocators share both copy descent and nested cell keys. By-value range variables get their own seeded cells while explicit references bind the source. Nested owners report their root variable so header file-static initializers replay through merge, and nested pair members are seeded and copied through their modeled member cells. A container-typed call result uses its return temp rather than writing a container value into the inner element cell; call-return element summaries remain a follow-up.

Validate every bracket in a subscript chain against the configured access model. Gate braced inner lists on the inner initializer_list opt-in and standalone constructor and allocator checks, reuse inner constructor viability for outer list validation, keep an ordinary inner constructor viable, and preserve the allocator reading when the one-argument reading is not viable. Detect braced copies by canonical type before a list reading, route typed braced temporaries and named copies through the same copy-or-list path, and accept matching typed mapped temporaries in entry lists. Single-pair map readings preserve mapped braces and allocator clauses only when the key clause is compatible, including allowed implicit class-key conversions; entry-list readings require every clause to fit a full entry, a known pair key to have both clauses, and a non-braced mapped value to be the inner container. Key inference is limited to recognized map layouts. Insertion effects require an emitted, unfiltered call site, and ignored macros filter typed, named and field-nested braced sources before copying.

Honor ignored field macros beneath range and nested subscripts, keep unevaluated chained subscript sites distinct, and validate the fixture with an explicit initializer_list, allocator-qualified inner vectors, an allocator-capable initializer-list constructor, a count/value inner constructor, and a usable iterator. Exercise vector-of-vector, map-of-vector, vector-of-map, three-level, alias, explicit-allocator and mixed-allocator copies, shared header statics, named and braced pair inserts, typed mapped entries, class/callback/pair keys, custom entry models, model opt-outs, explicit and by-value ranges, pointer elements, and unrelated-container isolation in tests/fixtures/cpp_nested_containers.

Recapture the canonical container-cell probes: HiView 35 -> 39 and Camera 8 -> 10 for the new outer and nested cells, with every other global and probe unchanged. Map iteration, structured bindings, and chained find-second lookups remain documented follow-ups.

Verified with cargo test --workspace, cargo clippy --workspace --all-targets -- -D warnings, cargo fmt --check, clang syntax-only checks of the fixture, the canonical HiView and Camera debug checks (44/44), and identical --jobs 1 and --jobs 8 exports.

@devnullexile-deepseek-review

devnullexile-deepseek-review Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 54a9b06)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
✅ Merge recommendation: No concerns found
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected
✅ Resolved findings

crates/trace-parse/src/container_elements.rs:2814-2818

Allocator copy from typed temporary

store_nested_braced only copies an allocator-extended source when
allocator_extended_copy returns Some(Some(from)). For a typed braced
temporary source such as
outer.push_back({std::vector<Callback>{alpha}, std::allocator<Callback>{}});,
the source type matches the inner container but has no element cell, so
validation can accept it while storage does not unpack the temporary's
braced contents. The callback in the temporary is then not modeled, so
a valid C++ allocator-extended copy loses its callables. Handle the
typed-source case in store_nested_braced (for example by extracting
typed_inner_braces from the source clause and lowering that payload
into the destination) instead of falling through to a list reading that
treats the temporary as an element.

crates/trace-parse/src/container_elements.rs:758-760

Pair key empty brace

key_braced_accepts rejects a pair key whose braced clause has zero elements (if pair { return clauses == 2; }). An empty brace value-initializes a pair key, so std::map<std::pair<int,int>, std::vector<Callback>> m; m.insert({{}, {alpha}}); and std::map<std::pair<int,int>, Callback> m = {{{}, alpha}}; are valid C++ (the key becomes {0,0}). In both paths the mapped value is dropped: for a nested mapped element inserted_values/key_viable rejects the single-pair reading and returns without storing, and for a map variable initializer list_element_conversions returns None for the whole list, so lower_list_initializer stores nothing. Before this PR no key validation existed, so the callback edge was kept; this is a precision regression for valid input. Allow a zero-clause brace for pair keys (value-initialization) while still rejecting a one-clause pair, and verify braced_value(entry_node, Some(0))? returns the empty brace so the key is not rejected before key_braced_accepts runs.

crates/trace-parse/src/container_elements.rs:852-868

Mixed entry list dropped

For an entry model (entry.is_some()), list_element_conversions maps every clause of an initializer list to its mapped slot (braced_value(entry_node, entry)). A clause that is not an initializer_list (a named std::pair variable, or a std::make_pair(...) call, both valid map entries) is returned as-is and then, when the mapped element type is a modeled container, inner_container_viable returns Some(false) for it, making the .all(...) predicate false. list_initialization then returns None, so lower_list_initializer stores no entries at all: std::map<int, std::vector<Callback>> m = {{1, {alpha}}, namedPair}; loses alpha even though that clause by itself is perfectly valid. This contradicts the "read clauses independently" behaviour implemented for insert (inserted_values handles named/make_pair clauses via append_pair_value), so mixed initializer lists are a precision regression rather than an unsoundness. A non-braced clause in a map's initializer list is a whole entry, not a mapped value; it should be interpreted as an entry (resolve pair/make_pair and copy its mapped member) or skipped without invalidating the other clauses, instead of being required to be the inner container itself.

crates/trace-parse/src/container_elements.rs:3060-3070

Question: extra entry-list reading

In the list_overload && initializer_list branch, after expanding every clause as a map
entry, the code also pushes braced_value(arg, entry) as an additional "single" reading
so that one pair with a braced key (insert({{1, 2}, {alpha, beta}})) is accepted. For a
multi-entry list such as insert({{alpha, {beta}}, {alpha, {beta}}}) into
std::map<Callback, std::vector<Callback>>, braced_value(arg, entry) would be the
second entry, not a mapped value: key_viable(arg) accepts the first entry because a
function-pointer alias is classified as an aggregate, and single_entry_viable accepts
{alpha, {beta}} as an inner std::vector<Callback> list, so alpha would be copied into
the mapped nested cell and the new map_callback_key_insert expectation (beta only)
would not hold. The branch is correct for a single pair with a braced key, so a guard
probably lives in braced_value (not visible in this diff), e.g. requiring the list to have
exactly entry + 1 clauses. Could you confirm that, or add an explicit clause-count check
before pushing this extra value?

CHANGELOG.md:28

Literal Escape

The new changelog entry has a literal \n inside the sentence
(... modeled accessor\ncalls descend to the receiver nested cell ...).
Markdown renders the backslash and n, so the released changelog shows
accessor\ncalls instead of normal text. This is the same authoring
artifact that appeared in tests/fixtures/cpp_nested_containers/store.cpp
(now fixed there), so it likely came from the same generation pass.
Documentation-only, no runtime effect; replace the escape with a space or
a real newline.

crates/trace-parse/src/container_elements.rs:735-748

Question: copy detection canonicalization

copies_container now compares the value's full spelling from
class_spelling_of_desc against elements.instance with plain string
equality. A direct braced copy whose declared spelling differs from the
source's but denotes the same C++ type (for example
std::vector<Callback, std::allocator<Callback>> b{a}; with a
declared std::vector<Callback>, or an alias spelling) would not
compare equal, whereas the previous base-class comparison
(std::vector vs std::vector) did recognize it as a copy. If
elements.instance and class_spelling_of_desc are not both canonical,
such a copy would fall through to the initializer-list reading and the
copied element cells would be lost (the fixture only covers immediate
copies via push_back/store paths, where copy_container_elements
canonicalizes). Could you confirm whether the two values are canonical,
or compare canonical_specialization(...) here as
copy_container_elements does?

tests/fixtures/cpp_nested_containers/store.cpp:8

Broken Fixture Source

Line 8 contains a literal escape sequence instead of line breaks:
}\n\nvoid use_shared_slots_store() {. A stray \ is not a valid C++
token, so the custom preprocessor/tree-sitter can only error-recover,
which may drop or mangle use_shared_slots_store; the new test
nested_container_elements_flow_through_subscripts_and_ranges asserts
that function must reach alpha, and store_slots is also affected.
If the diff is not a rendering artifact, replace the escape with real
newlines and a blank line between the two functions.

@devnullexile-deepseek-review

devnullexile-deepseek-review Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

DeepSeek review: Approved (54a9b06)

The review found nothing that blocks approval.

This is review 23 of this pull request. After 3 reviews the model's findings no longer block approval (max-blocking-reviews); security concerns, files not fully reviewed, open threads of the bot and paths a person approves still do.

This comment is updated on every review. The review comment and its threads have the details.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found several concrete issues across container_elements.rs, lower.rs, and the new fixture (in addition to the already-flagged literal \n\n on tests/fixtures/cpp_nested_containers/store.cpp:8 and the canonicalization question on copies_container):

  1. Single-element braced inner lists bypass inner-container validation in list_element_conversions, and ordinary_constructor_accepts misses canonical-prelude constructors and parameter compatibility.
  2. inserted_values has three separate validation bypasses (braced_allocator_arguments in single_entry_viable, untyped compound_literal_expression unwrapping, and falling through to the non-braced unwrap_braced_value path when preserve_braces checks reject an entry), and store_values writes non-container fallthrough values directly into the nested element cell.
  3. key_braced_accepts misclassifies pointer-to-template keys like std::pair<int, int>* and misses std::__1::pair / ::std::pair.
  4. Elements::for_receiver handles subscript_expression via access(...).nested(...) but routes modeled Access calls like .at(i) / .front() / .back() to an isolated return-temp cell.
  5. lower_statement_local misses reference type aliases when deciding whether a range-for variable aliases the nested container.

Comment thread crates/trace-parse/src/lower.rs Resolved
@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from d9da267 to 16e5d7a Compare November 26, 2026 13:06
Comment thread CHANGELOG.md Resolved
@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from 16e5d7a to 0cde965 Compare November 26, 2026 13:16

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 0cde965: the previously flagged issues have been addressed (including the CHANGELOG.md literal \n, store.cpp, and the nine prior review threads, which I have resolved), though the reference-alias fix only updated lower.rs and still drops flow in Elements::for_var.

Found several remaining issues in the updated code (detailed in the inline comments):

  1. inner_container_viable rejects braced copies of named inner containers ({{inner}}, {1, {inner}}) because list_initialization rejects copies_container.
  2. typed_inner_braces ignores template arguments, and copy_container_elements copies the first element level before checking specialization compatibility.
  3. Elements::for_var does not unwrap TypeDesc::Ptr for reference-type aliases recorded in nested_container_owners.
  4. Elements::for_receiver ("call_expression") misses method_is_from_ignored_macro and blocks unevaluated at/front/back chains via effects_allowed.
  5. store_values allocates an unused temp and emits a dead ContainerElement constraint whenever nested.is_some().
  6. inserted_values drops typed std::pair compound literals (std::pair<K, V>{k, ...}).
  7. canonical_specialization_at / canonical_desc_at lack canonical_declarations(ctx) defaults, can shift positions on partial default binding, and use Debug formatting for scalar fallback.
  8. key_braced_accepts misclassifies const int and void (*const)() keys as aggregates, ordinary_constructor_accepts canonical-prelude fallback accepts arbitrary argc > 3, and range_is_from_ignored_macro misses ignored [ brackets and ignored accessor method macros.

Comment thread crates/trace-parse/src/lower.rs Resolved

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in 0cde965.

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from 0cde965 to d6ace6d Compare November 26, 2026 13:43

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in d6ace6d.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed d6ace6d8: all 11 previous comments have been addressed and resolved. Found two remaining edge cases in container_elements.rs.

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from d6ace6d to ac9a52c Compare November 26, 2026 14:40

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in ac9a52c.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed ac9a52c: both previously open comments (effects_allowed checking method_is_from_ignored_macro and keeping std::pair compound literals out of the list_overload outer-list unwrap while unwrapping them per clause) are addressed, and I have resolved those two threads.

Found two remaining edge cases in crates/trace-parse/src/container_elements.rs (inline comments below).

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from ac9a52c to 4ef7374 Compare November 26, 2026 15:54

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in 4ef7374.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 4ef7374: both previously open threads (unwrap_or(value) / missing key_braced_accepts on line 829, and removing the entry.is_some() single push in inserted_values) are addressed, and I have resolved both threads.

Found five remaining issues in crates/trace-parse/src/container_elements.rs (detailed in the inline comments below).

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from 4ef7374 to dec75f6 Compare November 26, 2026 16:53

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in dec75f6.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed dec75f6: all 5 previously open threads (trace_ir::split_instance in key_braced_accepts, compound_pair_brace + {} handling in list_element_conversions / lower_list_initializer, lower_operation in store_nested_braced, independent map-clause extraction + single-pair count guard in inserted_values, and has_subscript_base in lower_subscript_call) have been addressed and resolved.

Found 4 remaining issues in container_elements.rs and lower.rs (inline comments attached).

Comment thread crates/trace-parse/src/lower.rs Resolved
@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from dec75f6 to c7ccd23 Compare November 26, 2026 17:29

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in c7ccd23.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed c7ccd23: all 5 previously open threads (first_is_entry for {1, {{alpha}, {}}} / 3-level single-pair inserts, all_clauses_inner for position inserts, split_top_level / has_top_level in type_spelling_for, and without_leading_cv in canonical_specialization / compound_pair_brace / initializer_list_literal) have been addressed and resolved.

Found one remaining edge-case bug in the new first_is_entry guard in crates/trace-parse/src/container_elements.rs (inline comment attached).

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from c7ccd23 to 37f4780 Compare November 26, 2026 17:57
@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from b7d4e1c to dd4eb96 Compare November 27, 2026 15:35

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed dd4eb961. All 7 CI checks (check, coverage, check-macos, check-windows, and the three release build jobs) passed on this commit.

Resolved the 8 addressed ArcsinX review threads (canonical_specialization_at / class_template_defaults canonical prelude lookup, type_spelling_node dispatch, key_braced_accepts unbraced pair rejection, std::initializer_list<T>{...} opt-in check, const Callback function-pointer alias qualifier placement, inserted_values unconditional return after failed single_entry_viable, and all_clauses_inner ignored-macro filtering).

Three issues remain on dd4eb961 (plus PRRT_kwDOT_8HwM68wOj7, which stays open until lower.rs:23110 is fixed); details are noted inline.

Comment thread crates/trace-parse/src/lower.rs Resolved

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in dd4eb96. 1 data file(s) were left out of the review for a person to check.

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from dd4eb96 to b8ec12d Compare November 27, 2026 15:54

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed b8ec12da (with CI/check, CI/check-windows, CI/coverage, and CI/build (aarch64-unknown-linux-gnu) passing; remaining CI jobs still in progress).

Resolved the 4 addressed ArcsinX threads (lower.rs:23110 top-level */& check via has_top_level, split_top_level + split_function_pointer_star for function-pointer aliases with pointer parameters, and pair_clause_key_matches in clause_is_entry).

Found two issues in the new pair_clause_key_matches logic in crates/trace-parse/src/container_elements.rs (inline comments attached).

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in b8ec12d. 1 data file(s) were left out of the review for a person to check.

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from b8ec12d to bf57e6a Compare November 27, 2026 18:07

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in bf57e6a.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed bf57e6ae (with all 7 CI/* checks passing: check, check-macos, check-windows, coverage, and the 3 build jobs).

Resolved the 2 addressed ArcsinX threads (pair_clause_key_matches replaced by pair_key_may_convert, and key compatibility now checked consistently in list_element_conversions and inserted_values).

Found two remaining key-validation issues in crates/trace-parse/src/container_elements.rs that can drop valid inner container values and leak key callbacks into the map's mapped cell (inline comments attached).

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from bf57e6a to 47ae01f Compare November 27, 2026 18:58

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in 47ae01f.

@devnullexile devnullexile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three earlier comments are resolved in 47ae01f:

  • canonical_alias_spelling_at now strips leading cv-qualifiers before alias lookup.
  • key_braced_accepts now accepts {} (and single-clause copy-list-init) for std::pair keys.
  • inserted_values now unwraps pair_brace for direct typed-pair inserts on non-nested maps too.

Found one new edge-case bug in type_spelling_for when cv-qualifying an already cv-qualified function-pointer alias.

Comment on lines +2533 to +2539
if pointer.take_prefix(tail).is_empty() {
qualifiers = TypeQualifiers::default();
format!("{pointee}*{}", pointer.spelling())
} else if alias.contains('(')
&& (!after.is_empty() || !qualifiers.spelling().is_empty())
{
} else if has_top_level(alias, '(') && !qualifiers.spelling().is_empty() {
let cv = qualifiers.spelling();
qualifiers = TypeQualifiers::default();
format!("{pointee}*{cv}{tail}")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] format!("{pointee}*{cv}{tail}") prepends cv directly onto the unstripped tail instead of using the merged pointer qualifiers and the remainder returned by pointer.take_prefix(tail). When qualifying an already cv-qualified function-pointer alias (e.g. using CCallback = void (*const)(); with const CCallback or volatile CCallback), tail starts with const)(), so this produces void (*constconst)() or void (*volatileconst)() (breaking canonical specialization equality with CCallback).

Suggested change
if pointer.take_prefix(tail).is_empty() {
qualifiers = TypeQualifiers::default();
format!("{pointee}*{}", pointer.spelling())
} else if alias.contains('(')
&& (!after.is_empty() || !qualifiers.spelling().is_empty())
{
} else if has_top_level(alias, '(') && !qualifiers.spelling().is_empty() {
let cv = qualifiers.spelling();
qualifiers = TypeQualifiers::default();
format!("{pointee}*{cv}{tail}")
let remainder = pointer.take_prefix(tail);
if remainder.is_empty() {
qualifiers = TypeQualifiers::default();
format!("{pointee}*{}", pointer.spelling())
} else if has_top_level(alias, '(') && !qualifiers.spelling().is_empty() {
qualifiers = TypeQualifiers::default();
format!("{pointee}*{} {remainder}", pointer.spelling())

@devnullexile devnullexile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — the remaining P2 on cv-qualified function-pointer aliases is non-blocking.

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from 47ae01f to 81147f9 Compare November 29, 2026 15:27

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in 81147f9.

@devnullexile devnullexile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The earlier findings on cv-qualified map key aliases, empty std::pair keys, and direct typed-pair inserts are addressed. This revision also fixes the duplicate and mixed cv qualifiers on single-level function-pointer aliases from my last review. I found one new regression in how the merge handles a pointer to a function pointer.

{
} else if has_top_level(alias, '(') && !qualifiers.spelling().is_empty() {
qualifiers = TypeQualifiers::default();
format!("{pointee}*{} {remainder}", pointer.spelling())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve cv qualifiers on the outer pointer

With using Slot = void (*const *)(int *); using ConstSlot = const Slot;, split_function_pointer_star picks the inner *. This merge absorbs the new const into the inner pointer’s existing const, so both aliases now have the same spelling. ConstSlot should spell void (*const *const)(int *).

That collision lets nested containers copy callback flow across distinct specializations. I reproduced a new indirect edge to alpha when a modeled Box<ConstSlot, Callback> was constructed from Box<Slot, Callback> by a converting constructor that leaves the destination callback null. Apply the alias qualifiers to the outer pointer in the declarator.

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from 81147f9 to c7acb88 Compare November 29, 2026 16:55

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in c7acb88.

@devnullexile devnullexile left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This revision resolves my finding about applying cv qualifiers to the outer pointer in void (*const *)(int *). I also verified the earlier fixes for cv-qualified map key aliases, empty std::pair keys, direct typed-pair inserts, and duplicate or mixed cv qualifiers on single-level function-pointer aliases. Two new declarator regressions are detailed inline.

}
'*' if angle == 0 && paren == 1 => {
let prefix = spelling[group_start..index].trim();
if star.is_some() || prefix.is_empty() || prefix.ends_with("::") {

@devnullexile devnullexile Nov 29, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Skip multiplication inside array bounds when finding the pointer declarator

using Slots = void (*[2 * 3])(int *);
using ConstSlots = const Slots;
using Written = void (*const[2 * 3])(int *);

Clang treats ConstSlots and Written as the same type. Once this scan has seen the pointer star, it also accepts the multiplication in [2 * 3], so alias expansion produces void(*[2*const 3])(int*). In the new Box test setup, using ConstSlots for the source and Written for the nested destination drops the stored callback's indirect edge on this commit. The edge was present on 81147f9. Track square-bracket nesting when selecting the declarator star.


[P2] Preserve type identity when cv is applied to a reference alias

using SlotRef = void (*const *&)(int *);
using ConstSlotRef = const SlotRef;

C++ ignores the added const on a reference alias. After the switch to the last pointer star, this spells ConstSlotRef as void(*const*const&)(int*), qualifying the pointer that SlotRef refers to. In the new Box test setup, storing a callback in Box<ConstSlotRef, Callback> and copying it into the nested Box<SlotRef, Callback> resolves the callback on 81147f9 and drops the edge on this commit. Check for a reference declarator before applying the alias's cv qualifiers.

@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from c7acb88 to 2465680 Compare November 29, 2026 18:24

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in 2465680.

@devnullexile devnullexile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This revision resolves my finding about skipping multiplication inside array bounds (e.g., void (*[2 * 3])(int *)) in split_top_level and split_function_pointer_star, and the changes since c7acb88 introduce no new issues.

The second finding from my previous comment—preserving type identity when cv qualifiers are applied to a reference alias such as void (*const *&)(int *)—remains unresolved in 2465680.

Model inner containers with an element summary keyed by the outer owner
and canonical inner specialization. Carry elements through copies, move
casts, allocator-extended construction, chained accesses, and nested
ranges. Bound alias spelling growth and reuse resolved access prefixes.

Check map key compatibility during entry recognition and extraction.
Accept viable conversions while keeping key-only callbacks out of the
mapped cell. Preserve callback parameter type identity and honor macro
provenance on explicit subscript operators.

Regression tests cover callback flow, key isolation, and deep aliases.
All 44 canonical HiView and Camera checks pass at one and eight jobs
with identical analysis rows across job counts.
@DrSergei
DrSergei force-pushed the feat/nested-container-flow branch from 2465680 to 54a9b06 Compare November 30, 2026 08:45

@devnullexile-deepseek-review devnullexile-deepseek-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated DeepSeek review found no blocking concerns in 54a9b06.

@devnullexile devnullexile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This revision resolves the remaining finding from my previous review on preserving type identity when cv qualifiers are applied to a reference alias (such as void (*const *&)(int *)), including both lvalue/rvalue and local reference aliases. All of my earlier comments are now resolved, and the changes since 2465680 introduce no new issues.

@ArcsinX ArcsinX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DrSergei
DrSergei merged commit 51493d3 into master Nov 30, 2026
9 checks passed
@DrSergei
DrSergei deleted the feat/nested-container-flow branch November 30, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants