Version
codebase-memory-mcp v0.8.1
Platform
Linux (x64)
Install channel
GitHub release archive / install.sh / install.ps1
Binary variant
standard
What happened, and what did you expect?
When a C++ file contains #ifdef / #else / #endif blocks around function signatures, the tree-sitter C++ parser silently skips all code from that point until a much later line, resulting in massive gaps in the knowledge graph.
Reproduction
File: SurfaceFlinger.cpp (11,657 lines)
Trigger pattern (line 2064):
#ifdef FLYME_GRAPHICS_EXTEND_LUMARGB
status_t SurfaceFlinger::addRegionSamplingListener(const Rect& samplingArea,
const sp<IBinder>& stopLayerHandle,
const sp<IRegionSamplingListener>& listener,
const bool rgbSample) {
#else
status_t SurfaceFlinger::addRegionSamplingListener(const Rect& samplingArea,
const sp<IBinder>& stopLayerHandle,
const sp<IRegionSamplingListener>& listener) {
#220
### Logs
```text
## Bug Description
When a C++ file contains `#ifdef` / `#else` / `#endif` blocks around function signatures, the tree-sitter C++ parser silently skips all code from that point until a much later line, resulting in massive gaps in the knowledge graph.
## Reproduction
**File:** `SurfaceFlinger.cpp` (11,657 lines)
**Trigger pattern (line 2064):**
#ifdef FLYME_GRAPHICS_EXTEND_LUMARGB
status_t SurfaceFlinger::addRegionSamplingListener(const Rect& samplingArea,
const sp<IBinder>& stopLayerHandle,
const sp<IRegionSamplingListener>& listener,
const bool rgbSample) {
#else
status_t SurfaceFlinger::addRegionSamplingListener(const Rect& samplingArea,
const sp<IBinder>& stopLayerHandle,
const sp<IRegionSamplingListener>& listener) {
#endif
Result:
- Methods indexed: lines 463–2065, then 10619–11637
- Gap: lines 2066–10618 (~8,552 lines) completely missing from graph
- Critical methods SurfaceFlinger::commit (line 2758) and SurfaceFlinger::composite (line 3007) are not indexed
Expected Behavior
All methods in the file should be indexed regardless of #ifdef blocks around signatures.
Actual Behavior
The parser appears to bail when encountering duplicate function signatures in #ifdef/#else branches, skipping everything until it finds a "clean" parse point ~8,500 lines later.
Impact
This affects any C/C++ codebase using conditional compilation for platform-specific or feature-flag variants of function signatures — very common in Android/AOSP, Linux kernel, and embedded projects.
Environment
- codebase-memory-mcp v0.8.1
- Linux amd64
- Indexing mode: full / moderate / fast (all exhibit the same gap)
Diagnostics trajectory (memory / performance / leak issues)
**File:** `SurfaceFlinger.cpp` (11,657 lines)
**Trigger pattern (line 2064):**
#ifdef FLYME_GRAPHICS_EXTEND_LUMARGB
status_t SurfaceFlinger::addRegionSamplingListener(const Rect& samplingArea,
const sp<IBinder>& stopLayerHandle,
const sp<IRegionSamplingListener>& listener,
const bool rgbSample) {
#else
status_t SurfaceFlinger::addRegionSamplingListener(const Rect& samplingArea,
const sp<IBinder>& stopLayerHandle,
const sp<IRegionSamplingListener>& listener) {
#endif
Project scale (if relevant)
No response
Confirmations
Version
codebase-memory-mcp v0.8.1
Platform
Linux (x64)
Install channel
GitHub release archive / install.sh / install.ps1
Binary variant
standard
What happened, and what did you expect?
When a C++ file contains
#ifdef/#else/#endifblocks around function signatures, the tree-sitter C++ parser silently skips all code from that point until a much later line, resulting in massive gaps in the knowledge graph.Reproduction
File:
SurfaceFlinger.cpp(11,657 lines)Trigger pattern (line 2064):
Diagnostics trajectory (memory / performance / leak issues)
Project scale (if relevant)
No response
Confirmations