A C-family file's preprocessed pass reads the repository files its quoted
#include lines name, so its graph changes with their bytes even when its
own bytes do not. An incremental refresh after an edit to a header alone
re-extracted only the header, and its includers kept their old expansion.
- The #include lookup resolves only to files the index run covers (its
discovery, through CBMIncludeScope and the pipeline context's
indexed_files), so every file an expansion depends on is in the run's
manifest.
- Each file's lsp_surface row records the files its lookup read
(included_files; transitive, since the headers a header includes are on
the includer's own list). It is not part of surface_sha.
- The closure planner adds every stored file whose record names a changed
or deleted file to the delta as a changed file, which then goes through
the same surface comparison. One pass over the stored rows.
- CBM_INDEX_FORMAT_VERSION 6 -> 7: an index written before records no
included files, so it is rebuilt once.
- The graph and content digests cover the new column; a database without
it keeps its previous digest stream.
Tests: pipeline_c_header_edit_refreshes_includers_incrementally (a header
edit reaches a direct and a transitive includer; the refresh equals a
fresh full index) and index_format_v6_included_files_rebuild.
Refs #2993
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The C/C++/CUDA preprocessed pass handed the file's repository-relative
path to simplecpp, which looked quoted #include names up relative to the
process working directory, so the graph depended on the directory the
indexer was started from.
Include lookup is now resolved against the indexed repository root
instead of the process working directory. Before simplecpp runs, every
#include and __has_include of the file, and of each header it reaches,
is resolved in the including file's directory within the repository
root and stored in simplecpp's FileDataCache under the key its own
lookup computes, so simplecpp opens no file itself. Headers are read
through cbm_fopen, with the rules discovery applies to what belongs to
the tree. Angle-bracket names and computed #include lines resolve to
nothing, as before. The pipeline passes its repository root to
cbm_extract_file_ex_with_tests; without one, no header resolves.
When the run that follows includes stops at #error (or at another
directive that makes simplecpp discard the expansion), the file keeps
its expansion without includes.
The expanded buffer holds only the file's own tokens. A header's macros
still shape them, but its body is indexed as its own file, with its own
lines: calls, usages and writes inside an included header are no longer
attributed to the includer, and the includer's lines keep their numbers.
Fixes#2993
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The preprocessed second pass rebuilt the expanded source with simplecpp's
TokenList::stringify(), which puts one space between every pair of tokens:
`template<> struct bitonic<int64_t, AVX2>` became
`bitonic < int64_t , AVX2 >`. Every QN builder takes the class segment from
node text, so a definition the #961 rescue re-adopted from that buffer
(vxsort's INLINE/NOINLINE macros break the raw parse on every method line)
got a second, token-spaced QN, and the QN-equality dedup kept both. CALLS
split across the two spellings (dotnet/runtime: 902 compact + 996 spaced
into the bitonic sorters).
The expanded buffer now keeps the source spacing: tokens that touched in
the source (same file and line, no macro expansion between them) stay
touching, every other gap is still one space, and the line structure and
#line directives are unchanged, so every line remap holds. One fix point
instead of a normaliser at each QN builder; no vendored code changes.
Proof (macOS arm64, dotnet/runtime 60108ba6, two identical runs each):
- duplicate definition groups 706 -> 217 (v0.11.0: 545); nodes with a
token-spaced QN 495 -> 0; CALLS into bitonic 902 + 996 -> 998, one
spelling. The remaining groups are coreclr gc.cpp's SVR/WKS builds (184)
and 33 scope disagreements between the two parses.
- Side effect: rapidjson document.h's GenericValue members now exist once,
with the raw parse's scope (the token-spaced copy that carried the
nested scope is gone); `operator[]` / `operator()` in the expanded pass
now parse as single tokens.
- New test (RED without the change): extraction
extract_cpp_template_specialization_preprocessed_qn_single_spelling.
Three c_lsp collision fixtures recalibrated to the new byte offsets
(comment padding and offsets only, assertions unchanged).
- extraction, c_lsp, pipeline, edge_types_probe, parse_coverage,
conditional_variants, lsp_resolution_probe: 1852 passed.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Collect a bounded set of conventional export macro candidates and inject empty definitions into the existing C/C++ preprocessing second pass without overriding explicit caller definitions.
Conservatively reconcile remapped definitions to recover hidden classes, structs, enums, free functions, and inline methods while suppressing matching base-class phantom callables.
Add focused regression coverage for supported suffixes, ordinary all-caps negative controls, candidate limits, comments, strings, raw strings, overlong names, explicit define priority, and C/C++ extraction.
Rebase onto main 92abefa3 and route the temporary superseded-definition bitmap through the extraction memory class to comply with the current allocation contract. Preserve the error-region dropped counter initialization.
Signed-off-by: XIYBHK <xiybhk@163.com>