fix: C and C++ extractor drops functions whose declarator has an unhandled shape
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Start with findFunctionDeclarator in internal/indexer/mainstream/cextract/cextract.go and compare its handled wrappers with the dropped shapes in the issue. Reproduce the name-side parentheses case with the provided shapes.cpp, then run codegraph init and codegraph callers foo; repeat for the other shapes. Done means each shape produces a function node with parameters and a caller result, or is recorded as a known limitation in docs/LANGUAGE-CAPABILITY-MATRIX.md.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
The C and C++ extractor drops every function whose declarator is not a handled wrapper. findFunctionDeclarator in internal/indexer/mainstream/cextract/cextract.go:586 unwraps only pointer_declarator, array_declarator, reference_declarator and parenthesized_declarator. Any other node returns nil, so the declaration gets no function node. The extractor logs nothing.
A suite review of branch fix/360-cpp-reference-return found this (finding QUAL-8, CONFIRMED). That branch fixes #360 for reference_declarator only. The shapes below also drop on main.
The reviewer named these shapes as dropped without a node:
- A parenthesized declarator around the name, for example
int (foo)(int a);. - An attributed declarator (
attributed_declarator), for example with[[nodiscard]]placed on the declarator. - A function that returns a function pointer, for example
int (*getfn(int))(char);. - A function typedef, for example
typedef int fn_t(int a);. - A template declaration (
template_declaration) that wraps a function.
The template shape is already a documented limitation. docs/LANGUAGE-CAPABILITY-MATRIX.md line 206 and internal/indexer/mainstream/cextract/types.go line 126 both list it. The matrix does not list the other four shapes.
Whether a function typedef gets a function node is an open question. Related: #360 (reference returns) and #354 (extern "C" blocks).
What you expected instead
Each shape gets a function node with its parameters, and codegraph callers finds a call to it from a one-file fixture. For any shape, docs/LANGUAGE-CAPABILITY-MATRIX.md can instead list it as a known limitation.
Steps to reproduce
This reproduces the name-side parentheses shape. Each other shape needs the same steps with its own declaration.
-
In an empty directory, create
shapes.cpp:int (foo)(int a) { return a; } int main() { return foo(1); } -
Run
codegraph init. -
Run
codegraph callers foo.
Expected: main is listed as a caller of foo. Actual output is not recorded yet for any shape, so each shape needs its own run.
Version
Built from source at commit cf975c47 (branch fix/360-cpp-reference-return).
Platform
macOS, Darwin 27.2.0
How did you install it?
Built from source
Languages in the affected repository
C and C++. The extractor is internal/indexer/mainstream/cextract/. The matrix documents the template gap, but not the other four shapes.
Before submitting
- I searched existing issues and this is not a duplicate
- I reviewed the capability matrix and this is not a documented limitation
- This is not a security vulnerability
🤖 Generated with Claude Code
- Lingua principale
- Go
- Stelle
- 0
- Fork
- 0
- Merge medio
- 7h 42m
- PR unite (30g)
- 111
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di seanb4t/codegraph-go
-
chore needs-triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
seanb4t/codegraph-go#380 ·
I maintainer di solito rispondono entro 1 giorno
-
chore needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
seanb4t/codegraph-go#379 ·
I maintainer di solito rispondono entro 1 giorno
-
area:query chore needs-triage spec-needed
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
seanb4t/codegraph-go#377 ·
I maintainer di solito rispondono entro 1 giorno
-
chore needs-triage
Difficoltà 1/5 1-3 ore Idoneità per principianti 84/100
seanb4t/codegraph-go#362 ·
I maintainer di solito rispondono entro 1 giorno
-
area:query bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
seanb4t/codegraph-go#355 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di seanb4t/codegraph-go
Issue simili
-
Add iterate GmbH domains to a dedicated list and include it in company and developer categoriesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
v2fly/domain-list-community#4307 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
notify: voice_queue rows are deleted only at startup, so a hub that stays up grows it without boundAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
mattabate/life-distributable#232 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno