fix(cpp-lsp): use direct includes to disambiguate receiver targets - #2541
Open
knewstimek wants to merge 1 commit into
Open
knewstimek wants to merge 1 commit into
knewstimek wants to merge 1 commit into
Conversation
Prefer a unique receiver consistent with the current module or a direct quoted relative header include. Preserve namespace boundaries and propagate exact-site ambiguity into CALLS materialization. Cover references, pointers, ties and parallel extraction with synthetic regressions. Signed-off-by: knewstimek <knewstimek@users.noreply.github.com>
knewstimek
force-pushed
the
fix/cpp-duplicate-receiver-target
branch
from
October 4, 2026 04:02
07cd40e to
7d3e09b
Compare
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
This branch has not been deployed
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.
Direct C++ member calls through a reference or pointer can resolve to a mirrored definition even when the caller directly includes the intended header. In the synthetic regression, adding a duplicate header and implementation reduces the intended method's callers from three to one:
UseRefandUsePtrmove to the mirrored method whileAcquireAgainremains.This change ranks fallback receiver candidates using the current module and top-level literal quoted relative header includes, preserves namespace boundaries, and requires a unique best candidate. Exact invocation span and source origin carry ambiguity into CALLS materialization so later textual fallback does not select a tied receiver.
The synthetic unit regression checks registration order, module-prefix collisions and qualified namespaces. Seven real stdio MCP cases cover baseline, duplicate definitions, an explicit mirrored include, ambiguous includes, absent include evidence, a qualified namespace and a namespace mismatch. Two cases exercise the parallel extraction path.
Validation: Windows LLVM-MinGW build and seven real MCP regression cases passed. Changed C formatting, Python syntax and
git diff --checkpassed. Full repository lint success is not claimed: prior attempts encountered existing formatting violations and Windows tool execution failures. Linux and sanitizer checks remain unverified.Run
python tests/test_cpp_duplicate_calls.py <binary>.Scope: top-level literal quoted relative
.h/.hpp/.hh/.hxxincludes. Compiler search paths, parent traversal, macro/conditional/transitive includes and compiler-equivalent visibility are outside this change. It does not implement factory-return inference or guarantee correctness for every C++ receiver. Existing stored graphs require reparsing affected callers to receive corrected edges.