Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions docs/specs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 2026-11-23 — S1 0.4.0: a generated unit names the file it copies

S1 §7.2: a `source` entry of `ide.generated` may carry `origin`, the absolute path of the authored file the generated
unit is a transformed copy of, one of its generator's `inputs`, as the step that writes the unit states it; a producer
does not infer it from `inputs` (S1-7.2-14). A consumer treats that file as the unit's source for navigation and
diagnostics, and not as a second provider of the unit's module (S1-7.2-15). mcpp writes it from the build rule's
`mcpp::action::origin` (mcpp-community/mcpp#1004). Additive: a MINOR version of the profile; a consumer of 0.3.0 reads
a 0.4.0 document as before.

## 2026-11-22 — S3: a shadowed source, and a file not formatted

Two notice codes are named (mcpp-language-server#95). `shadowed-source`: an open file that is not compiled as it is,
Expand Down
2 changes: 1 addition & 1 deletion docs/specs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This directory holds the normative specifications that let C++ named modules be

| Spec | Title | Version | Status | Schema |
|---|---|---|---|---|
| [S1](s1-build-database.md) | C++ Build Database: IDE Profile | profile-version 0.3.0 | Draft | [s1-build-database.schema.json](schema/s1-build-database.schema.json) |
| [S1](s1-build-database.md) | C++ Build Database: IDE Profile | profile-version 0.4.0 | Draft | [s1-build-database.schema.json](schema/s1-build-database.schema.json) |
| [S2](s2-discovery.md) | Build Database Discovery Protocol | 0.3.0 | Draft | [s2-discovery.schema.json](schema/s2-discovery.schema.json) |
| [S3](s3-lsp-extensions.md) | Language Server Protocol Extensions for C++ Modules | protocol version 1 | Draft | TypeScript interfaces in the text; [target selection field](schema/s3-target-selection.schema.json) |
| [S4](s4-semantic-kit.md) | Semantic Kit | kit-version 1 | Draft | [s4-kit.schema.json](schema/s4-kit.schema.json) |
Expand Down
4 changes: 3 additions & 1 deletion docs/specs/s1-build-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
| | |
|---|---|
| Specification | S1 |
| Profile version | 0.3.0 |
| Profile version | 0.4.0 |
| Status | Draft |
| Schema | [`schema/s1-build-database.schema.json`](schema/s1-build-database.schema.json) |
| Examples | [`examples/s1-level3-gcc.json`](examples/s1-level3-gcc.json), [`examples/s1-level2-clang-two-sets.json`](examples/s1-level2-clang-two-sets.json) |
Expand Down Expand Up @@ -179,6 +179,7 @@ A build can generate files that the units of a set compile or include: sources a
| `path` | string | MUST | Absolute path of the file or directory in the configuration this document describes, as the units' `arguments` name it. <a id="S1-7.2-1"></a><sup>S1-7.2-1</sup> |
| `build-path` | string | SHOULD | Absolute path at which the build of the same configuration writes it. It differs from `path` when the producer plans in a directory of its own, and equals `path` otherwise. It is stated whether or not the file exists. <a id="S1-7.2-2"></a><sup>S1-7.2-2</sup> |
| `kind` | enum | MUST | `source` (a unit of the set is compiled from it), `header` (units of the set include it) or `directory` (an include directory whose contents are generated). <a id="S1-7.2-3"></a><sup>S1-7.2-3</sup> |
| `origin` | string | MAY | For `source` only: the absolute path of the authored file the generated unit is a transformed copy of (the file a person edits to change the unit), one of the generator's `inputs`, as the step that writes the unit states it. A producer **MUST NOT** infer it from `inputs`. <a id="S1-7.2-14"></a><sup>S1-7.2-14</sup> (0.4.0) |
| `generator` | object | conditional MUST | REQUIRED for `source` and `header`, absent for `directory`. It has `id` (string, MUST), the producer's name for the step that writes the file; `inputs` (string[], SHOULD), the absolute paths of the files the step reads; `arguments` (string[], SHOULD), the step's command, program first; and `work-directory` (string, MAY). <a id="S1-7.2-4"></a><a id="S1-7.2-5"></a><a id="S1-7.2-6"></a><a id="S1-7.2-7"></a><a id="S1-7.2-8"></a><sup>S1-7.2-4, S1-7.2-5, S1-7.2-6, S1-7.2-7, S1-7.2-8</sup> |

A producer **SHOULD** list every generated file that a unit's `arguments` name, and every generated file in an include directory that the `arguments` name, whenever it knows the step that writes the file. <a id="S1-7.2-9"></a><sup>S1-7.2-9</sup> A translation unit whose `source` is the `path` of a `source` entry is a generated unit: before a build its source may be absent or empty.
Expand All @@ -188,6 +189,7 @@ A consumer:
- **MUST NOT** report a unit's reference to a generated file that does not exist as an error in that unit's source, and **SHOULD** tell the user that the file is generated, by which step, and that a build writes it; <a id="S1-7.2-10"></a><a id="S1-7.2-11"></a><sup>S1-7.2-10, S1-7.2-11</sup>
- **MAY** read the file at `build-path` when it exists, read-only (section 14), and **MUST** then treat it as possibly stale relative to the step's inputs; <a id="S1-7.2-12"></a><sup>S1-7.2-12</sup>
- **MUST NOT** run a step's `arguments` unless the user has allowed it for the workspace (section 14). <a id="S1-7.2-13"></a><sup>S1-7.2-13</sup>
- **SHOULD**, for a `source` entry with `origin`, treat the authored file as the source of the generated unit for navigation and diagnostics, and **MUST NOT** treat it as a second provider of the module the unit provides. <a id="S1-7.2-15"></a><sup>S1-7.2-15</sup> (0.4.0)

Rationale: a producer that does not build (for example mcpp's `emit build-database`, which writes nothing into the project and runs no build step) plans in a directory of its own, so a generated header named by the units' `-I` arguments is absent there. Without this object a consumer reports a missing header in every source that includes it and loses the semantics of that source. The object states which files are generated and where the build writes them; running the generators remains a decision of the consumer and its user.

Expand Down
3 changes: 3 additions & 0 deletions docs/specs/schema/s1-build-database.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@
"directory"
]
},
"origin": {
"$ref": "#/$defs/nonEmptyString"
},
"generator": {
"type": "object",
"required": [
Expand Down
Loading