Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
e30f959
feat(types): add the interned type store
CppCXY Dec 1, 2026
7cd161a
feat(types): intern summary types and compact the type node
CppCXY Dec 1, 2026
1102f00
feat(types): persist the type table and add the computed type
CppCXY Dec 1, 2026
d7d4f06
feat(types): add the fact-to-computed-type query bridge
CppCXY Dec 1, 2026
29bb6f1
feat(types): cache computed types per request
CppCXY Dec 1, 2026
5ea5909
feat(types): account for the summary type tables
CppCXY Dec 1, 2026
b34c8db
feat(types): use the stored handle in the pointee member path
CppCXY Dec 1, 2026
c4eef8c
feat(types): route fact type inference through the stored handle
CppCXY Dec 1, 2026
81a6be8
feat(types): store parameter type handles in DeclDetail
CppCXY Dec 1, 2026
10ed866
feat(types): read template-hint parameters from the type store
CppCXY Dec 1, 2026
633147d
feat(types): read completion detail and inlay returns from handles
CppCXY Dec 1, 2026
934acb1
test(types): pin type deduplication across declarations
CppCXY Dec 1, 2026
7480d7b
feat(types): source fact spellings from the type store
CppCXY Dec 1, 2026
8a5d646
feat(types): read alias targets through the store spelling
CppCXY Dec 1, 2026
437b54a
feat(types): stop duplicating type spellings in the cache
CppCXY Dec 1, 2026
ca35acb
docs(types): record codec 43 spelling dedup
CppCXY Dec 1, 2026
932d299
feat(facts): share type spellings through Arc<str>
CppCXY Dec 1, 2026
2facb52
feat(facts): keep declaration detail vectors inline
CppCXY Dec 1, 2026
bc8ff7c
docs: redesign facts around CST identities
CppCXY Dec 2, 2026
7c10712
feat(params): add CST-derived parameter facts
CppCXY Dec 2, 2026
3605aec
feat(facts): store CST parameter facts on declarations
CppCXY Dec 2, 2026
f101d2a
refactor(params): delete the synthetic parameter-name parser
CppCXY Dec 2, 2026
67828d3
feat(params): add the hash-consed parameter store
CppCXY Dec 2, 2026
92ded90
feat(syntax): add the SyntaxId resolver
CppCXY Dec 2, 2026
fdf6e54
feat(params): import local parameter tables
CppCXY Dec 2, 2026
13e630a
feat(params): give the project index a parameter store
CppCXY Dec 2, 2026
585a61f
feat(facts): attach parameter handles to declarations
CppCXY Dec 2, 2026
8797f4f
feat(params): resolve a fact's local parameter handle
CppCXY Dec 2, 2026
d754efd
feat(params): lower parameter types and read argument counts from facts
CppCXY Dec 2, 2026
e0020e9
refactor(overload): read parameter types from facts
CppCXY Dec 2, 2026
3a7874f
test(params): pin overload input to CST parameter facts
CppCXY Dec 2, 2026
f5a51da
feat(params): resolve cooked facts through the source summary
CppCXY Dec 2, 2026
4f9b87d
refactor(checks): read missing-include types from parameter facts
CppCXY Dec 2, 2026
4580bfc
refactor(params): delete the synthetic parameter-type parser
CppCXY Dec 2, 2026
d797fc2
refactor(facts): delete the duplicate parameter type ids
CppCXY Dec 2, 2026
bd522cc
refactor(params): resolve parameter names through the summary arena
CppCXY Dec 2, 2026
8343d38
refactor(facts): build parameter arenas in the fact builder
CppCXY Dec 2, 2026
b120481
refactor(signature): use the file's own tree instead of a synthetic f…
CppCXY Dec 2, 2026
0f66a60
docs: record the signature tree fallback
CppCXY Dec 2, 2026
ed5c086
refactor(params): delete the last parameter-list text parsers
CppCXY Dec 2, 2026
6539a90
docs(signature): describe the tree fallback after deleting the synthe…
CppCXY Dec 2, 2026
65dee41
refactor(constant): lex an expression instead of parsing a fragment
CppCXY Dec 2, 2026
2d027e2
refactor(constant): evaluate the CST's own tokens
CppCXY Dec 2, 2026
c215e35
refactor(constraint): read the requires condition from its node
CppCXY Dec 2, 2026
21372db
refactor(constraint): find enable_if through typed template arguments
CppCXY Dec 2, 2026
340c6d0
refactor(checks): read type spellings through the index
CppCXY Dec 2, 2026
d9d37ac
refactor(session): read fact types through the index
CppCXY Dec 2, 2026
3eb4e75
refactor(index): read fact types through the spelling bridge
CppCXY Dec 2, 2026
4c8aed3
refactor(deduce): read auto from the index spelling
CppCXY Dec 2, 2026
d03cb7f
refactor(render): take type spellings from the caller
CppCXY Dec 2, 2026
408030b
refactor(facts): intern type handles in the builder
CppCXY Dec 2, 2026
a25f595
refactor(render): remove the an_item test wrapper
CppCXY Dec 2, 2026
a69b1c3
refactor(substituted): rebuild member facts instead of mutating them
CppCXY Dec 2, 2026
912959d
Revert "refactor(substituted): rebuild member facts instead of mutati…
CppCXY Dec 2, 2026
09e818f
docs: separate the index cache from the computation layer
CppCXY Dec 2, 2026
2c8d9c1
refactor(model): keep member-list caching on the computation side
CppCXY Dec 2, 2026
7e0013d
feat(types): substitute a ComputedType without the store
CppCXY Dec 2, 2026
48143e6
feat(types): convert a semantic Type to ComputedType structurally
CppCXY Dec 2, 2026
75afab6
feat(model): add the ComputedType members entry point
CppCXY Dec 2, 2026
04eef8d
feat(model): cache computed member answers by ComputedType
CppCXY Dec 2, 2026
d5b3248
refactor(members): substitute from ComputedType arguments
CppCXY Dec 2, 2026
277f23d
refactor(substituted): build a fresh member view and clear stale type…
CppCXY Dec 2, 2026
140cc4d
feat(members): attach a per-member substitution context
CppCXY Dec 2, 2026
b48d3de
feat(model): materialize a substituted member type as ComputedType
CppCXY Dec 2, 2026
e965492
refactor(calls): read returns through the index spelling
CppCXY Dec 2, 2026
644b586
docs: replace the type redesign with the identity-based plan
CppCXY Dec 2, 2026
a6a8bf9
feat(facts): add DeclFactId and FactRef resolution
CppCXY Dec 3, 2026
e134951
refactor(facts): make ProjectDefinition a FactRef
CppCXY Dec 3, 2026
5a8e243
refactor(members): make ProjectMember a FactRef row
CppCXY Dec 3, 2026
0c7d82f
refactor(completion): make offered names FactRef rows
CppCXY Dec 3, 2026
8517338
refactor(facts): remove the type strings from DeclFact
CppCXY Dec 3, 2026
f00c6e7
refactor(facts): represent fact types as one enum
CppCXY Dec 3, 2026
66cf175
refactor(params): delete the build-time parameter fact copy
CppCXY Dec 3, 2026
99c4053
feat(files): use session VFS file ids at runtime
CppCXY Dec 3, 2026
61d76cd
refactor(constraint): evaluate typed conditions
CppCXY Dec 3, 2026
b508d0c
refactor(convert): take parsed target types
CppCXY Dec 3, 2026
05462ee
refactor(params): lower parameter and return types structurally
CppCXY Dec 3, 2026
1475a0f
refactor(params): store the C variadic list bit
CppCXY Dec 4, 2026
be26c88
refactor(types): represent C elaborated record tags
CppCXY Dec 4, 2026
701458d
refactor(types): reshape ComputedType into primary forms
CppCXY Dec 4, 2026
2968d72
refactor(types): delete the stored type arena
CppCXY Dec 4, 2026
80b109e
refactor(types): delete the duplicate semantic Type enum
CppCXY Dec 4, 2026
69bb7ea
refactor(constraints): store structured concept facts
CppCXY Dec 4, 2026
0eb0e9b
refactor(members): split alias targets structurally
CppCXY Dec 4, 2026
1d52381
refactor(session): carry expression types structurally
CppCXY Dec 4, 2026
f1ab0b2
refactor(handlers): use structured expression types
CppCXY Dec 4, 2026
1434495
refactor(inference): construct static types directly
CppCXY Dec 4, 2026
3cf6b31
refactor(deduction): read parameter and const structure
CppCXY Dec 4, 2026
503bc3a
refactor(ranges): return element types structurally
CppCXY Dec 4, 2026
8588f72
refactor(hover): prefer structured object members
CppCXY Dec 4, 2026
195483e
refactor(casts): lower cast targets structurally
CppCXY Dec 4, 2026
ac5c88f
refactor(arrow): return reached types structurally
CppCXY Dec 4, 2026
4dc3bd0
refactor(inference): construct size_t directly
CppCXY Dec 4, 2026
33ecf70
refactor(operators): return operator types structurally
CppCXY Dec 4, 2026
a570ad4
refactor(subscript): keep concrete class answers structured
CppCXY Dec 4, 2026
d0e73a1
clean code
CppCXY Dec 4, 2026
e4b3990
refactor(subscript): resolve dependent members structurally
CppCXY Dec 4, 2026
edc650b
refactor(arrays): carry structural extents and size layout from them
CppCXY Dec 4, 2026
90d546f
refactor(constraints): distinguish type and value arguments
CppCXY Dec 4, 2026
a7248b4
fix(layout): size enums as their underlying integer
CppCXY Dec 4, 2026
35b2959
fix(facts): deduce pair and tuple arguments from braced literals
CppCXY Dec 4, 2026
06138dc
clean code
CppCXY Dec 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ lsp-server = "0.10.0"
lsp_types = { version = "0.1.0", package = "emmy_lsp_types" }
tokio = { version = "1.54", features = ["full"] }
tokio-util = "0.7.20"
serde = { version = "1.0.229", features = ["derive"] }
serde = { version = "1.0.229", features = ["derive", "rc"] }
serde_json = "1.0.154"
rowan = { version = "0.17.0" }
glob = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion crates/cpp_code_analysis/src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ use std::path::{Path, PathBuf};
///
/// # Why this moved to 65
///
/// **A stored parameter list dropped its comments.** `tidy_list_text` collapses a declaration`s layout into one line,
/// **A stored parameter list dropped its comments.** The display renderer collapses a declaration's layout into one line,
/// and a comment written between two parameters stayed in it: `parameters_in` then split at the comma *inside* the
/// comment, and a parameter`s spelling became "`if not null */ sqlite3_value *`" — measured on sqlite, six
/// `param-type-check` findings about a type no file writes. A summary is keyed by content and context, neither of
Expand Down
447 changes: 367 additions & 80 deletions crates/cpp_code_analysis/src/cache/summary.rs

Large diffs are not rendered by default.

827 changes: 795 additions & 32 deletions crates/cpp_code_analysis/src/cache/summary_codec.rs

Large diffs are not rendered by default.

38 changes: 37 additions & 1 deletion crates/cpp_code_analysis/src/cache/unit_codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,39 @@ use crate::summary::{RenderedUnit, UnitMessage, UnitSpan};
const MAGIC: [u8; 4] = *b"UNIT";

/// Bumped when the layout changes; an older record is then unreachable rather than misread.
pub const UNIT_CODEC_VERSION: u32 = 4;
///
/// 5: each file's facts are encoded through the summary codec's declaration record, which no longer carries a type
/// spelling — the reading's types are values inside the summary-shaped body instead.
///
/// 6: the per-file records a program read writes come from [`crate::ProjectIndex::insert_cooked`]'s rewritten table.
/// A unit record from the first version of this layout could pair filed handles with a pre-filing table, so it is
/// refused rather than resolved through the wrong nodes.
///
/// 7: each file's record now carries its **parameter table** through the summary-shaped body — the field the
/// cooked-reading codec gained in its version 8. A record written before it has facts whose `ParamsId`s name a table
/// it never wrote, so it is refused rather than resolved through an unrelated arena.
///
/// 8: the summary-shaped body's declaration records gained the parameter list's own `...` byte — the field
/// [`crate::summary_codec::CODEC_VERSION`] 45 added. A record written before it has a fact record the summary decoder
/// would read from the wrong offsets, so it is refused rather than misread.
///
/// 9: the summary-shaped body's declaration records carry `ComputedType` values rather than type-table handles — the
/// field [`crate::summary_codec::CODEC_VERSION`] 47 changed. A record written before it has handles where the decoder
/// expects type values, so it is refused rather than misread.
///
/// 10: those declaration records now carry their **template-head constraints structurally** — the field
/// [`crate::summary_codec::CODEC_VERSION`] 48 added. A record written before it has the `requires_clause` field where
/// the decoder expects the structured slots, so it is refused rather than misread.
///
/// 11: those declaration records now carry an array's **bound structurally** — the field
/// [`crate::summary_codec::CODEC_VERSION`] 49 added. A record written before it has the old presence byte where the
/// decoder expects a named dimension's string, so it is refused rather than misread.
///
/// 12: those declaration records now carry each template-head constraint argument **as an argument** — the field
/// [`crate::summary_codec::CODEC_VERSION`] 50 added. A record written before it writes the type grammar tag where
/// the decoder expects the argument tag, and a value argument of that record is a type named `42`, so it is refused
/// rather than decoded into that wrong answer.
pub const UNIT_CODEC_VERSION: u32 = 12;

#[derive(Debug)]
pub enum DecodeError {
Expand Down Expand Up @@ -450,6 +482,7 @@ pub fn decode_indexed_unit(bytes: &[u8]) -> Result<IndexedUnit, DecodeError> {
path,
CookedFile {
declarations: summary.declarations,
parameters: summary.parameters,
macros: summary.macros,
diagnostics,
unplaced,
Expand Down Expand Up @@ -488,6 +521,7 @@ fn as_a_summary(path: &Path, cooked: &CookedFile) -> FileSummary {
path: path.to_path_buf(),
key: SummaryKey::new(0, 0),
declarations: cooked.declarations.clone(),
parameters: cooked.parameters.clone(),
macros: cooked.macros.clone(),
includes: Vec::new(),
guards: SummaryGuards::default(),
Expand All @@ -503,6 +537,7 @@ mod index_tests {
use crate::CookedDiagnostic;
use crate::CookedFile;
use crate::IndexedUnit;
use crate::index;

#[test]
fn an_indexed_unit_survives_a_round_trip() {
Expand All @@ -511,6 +546,7 @@ mod index_tests {
PathBuf::from("/p/a.h"),
CookedFile {
declarations: Vec::new(),
parameters: index::params::ParamsStore::default(),
macros: Vec::new(),
diagnostics: vec![CookedDiagnostic {
range: SourceRange::new(3, 4),
Expand Down
14 changes: 10 additions & 4 deletions crates/cpp_code_analysis/src/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ use crate::ModuleUnit;
use crate::RenderedUnit;
use crate::directive;
use crate::guards;
use crate::index::params::ParamsStore;
use crate::preprocess;
use crate::sema;
use crate::summary;
Expand All @@ -69,10 +70,12 @@ use cpp_parser::{CppParser, CppSyntaxTree, ParserConfig};
pub mod effect;
pub mod environment;
mod names;
pub mod params;
pub mod project;
pub mod references;
pub mod store;
pub mod surface;
pub mod syntax;
pub mod types;
pub mod walk_census;
pub mod watch;
Expand Down Expand Up @@ -826,9 +829,10 @@ impl<'a, F: FileProvider> FileIndexer<'a, F> {
.map(|error| source_range(error.range))
.collect();

let (mut declarations, mut guards) =
{ build_facts(&scopes, &preprocessing, &root, &errors, keep_locals) };

let built = build_facts(&scopes, &preprocessing, &root, &errors, keep_locals);
let mut declarations = built.facts;
let mut guards = built.guards;
let parameters = built.parameters;
let mut interner = PathInterner::new(cfg!(windows));
// **This file's compilation, not the project's** — see `CompilerConfig::for_file`.
let per_file = self.config.for_file(path);
Expand Down Expand Up @@ -959,6 +963,7 @@ impl<'a, F: FileProvider> FileIndexer<'a, F> {
path: path.to_path_buf(),
key,
declarations,
parameters,
macros,
includes,
guards,
Expand Down Expand Up @@ -1093,6 +1098,7 @@ impl<'a, F: FileProvider> FileIndexer<'a, F> {
// like a real one would invite exactly that. The walk does not read it.
key: SummaryKey::new(0, 0),
declarations: Vec::new(),
parameters: ParamsStore::default(),
macros,
includes,
guards,
Expand Down Expand Up @@ -1687,7 +1693,7 @@ fn file_what_was_found(
// The count is not lost: [`crate::IndexedUnit::errors`] is the stream's own count, and a consumer that wants to
// say "this program did not parse" has it. What is *not* published is a place for it, because the place the
// stream gives does not name one.
let _ = (tree, files, unplaced);
let _ = tree;
}

/// Give `#include "local.h"` the token the parser gives it: a header name — **the shared implementation lives in
Expand Down
Loading
Loading