fix(cpp): resolve using-alias and typedef constructions to the aliased class - #797
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for resolving C++ alias constructions (such as using and typedef declarations) to their underlying classes, ensuring that INSTANTIATES and constructor CALLS relationships are correctly captured. It also adds comprehensive unit tests to verify this behavior. The reviewer suggested a minor improvement in the test helper function to compare enum members directly rather than converting them to strings.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Greptile SummaryThis PR updates C++ alias construction resolution. The main changes are:
Confidence Score: 5/5Safe to merge with low risk. The change is narrowly gated to unresolved C++ bare calls whose alias resolves to a registered class. Tests cover the main positive paths and the prior scoping edge cases. No accepted issues remain. No files require special attention.
What T-Rex did
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Unresolved C++ bare call] --> B[Collect caller-local typedef/using aliases once]
B --> C{Local alias window contains call?}
C -- yes --> D[Use alias underlying name with latest declaration]
C -- no --> E[Use original call name]
D --> F{Underlying resolves to registered class?}
E --> G{Call name exists in global alias map?}
G -- yes --> F
G -- no --> H[Continue unresolved fallback chain]
F -- yes --> I[Set callee to CLASS]
F -- no --> H
I --> J[Existing class branch emits INSTANTIATES and constructor CALLS]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Unresolved C++ bare call] --> B[Collect caller-local typedef/using aliases once]
B --> C{Local alias window contains call?}
C -- yes --> D[Use alias underlying name with latest declaration]
C -- no --> E[Use original call name]
D --> F{Underlying resolves to registered class?}
E --> G{Call name exists in global alias map?}
G -- yes --> F
G -- no --> H[Continue unresolved fallback chain]
F -- yes --> I[Set callee to CLASS]
F -- no --> H
I --> J[Existing class branch emits INSTANTIATES and constructor CALLS]
Reviews (6): Last reviewed commit: "fix(cpp): scope local-struct member alia..." | Re-trigger Greptile |
|
@greptile review |
|
@greptile review |
|
@greptile review |
…bind by innermost window
|
@greptile review |
|
@greptile review |
|



Problem
using appender = basic_appender<char>; appender(out)constructs the aliased class, but the alias is not a registered node, so the bare call resolved to nothing and the class's constructor kept zero incoming edges. fmt'sbasic_appender.basic_appenderstayed on the dead list after #791 for exactly this reason (every construction site spells the alias). Third follow-up from the #791 residual audit.Fix
call_processor.py: in the unresolved-bare-name fallback chain, a C++ call name that appears in the collected typedef/using alias map and that_resolve_class_name(which follows alias chains and requires registration) binds to a registered class becomes a class callee. It then drops into the existing class branch, which emitsINSTANTIATESplus the constructorCALLSredirect like any direct construction. Gated on alias-map membership, so genuinely unknown names keep their unresolved handling, and an alias to a non-class (using count_t = int;functional casts) stays edge-free.Validation
basic_appender.basic_appenderrevived — the predicted FP), nlohmann stable at 261. Zero newly-dead entries; revive-only change.Tests
RED -> GREEN:
test_cpp_alias_construction.py—usingalias, template alias (using view = basic_view<int>),typedef, and the alias-to-primitive negative control.