Crafter.Build/implementations
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jorijn van der Graaf 5ca2b3e1df refactor(lint): single-declaration splits on the AST, per-declarator type
Tokens are not enough for this one, which is worth stating because it is the
opposite of the enum-class case. Splitting a multi-declarator statement by
copying the shared type prefix is wrong in C++:

    int* a, b;   ->   int* a; int* b;    // b was int, not int*

Only per-declarator types get it right, and clang has already resolved them —
`int *` for a, plain `int` for b. A token-based splitter cannot know.

The regex it replaces bailed on `*`, `&`, `<>`, parens and quotes, so pointers,
templates and call initialisers were all left alone. All three split now, and
the fixture proves the mixed pointer case above comes out correctly.

Groups are found structurally rather than by matching a line shape: the first
declarator's extent starts at the shared type, so begin < nameOffset, while a
continuation declarator's starts at its own name, so begin == nameOffset. That
signal comes from the AST itself. nameOffset is now on LintDecl, which is also
what lets the replacement reuse each declarator's original text verbatim
instead of reconstructing it.

Replacing a byte range rather than rewriting whole lines means a comment after
the ';' is outside the edit and survives — the line-based version refused to
touch any line carrying a comment. A comment INSIDE the statement still bails,
since the rewrite would swallow it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 00:35:52 +02:00
..
Crafter.Build-Asset.cpp linting 2026-07-23 01:24:42 +02:00
Crafter.Build-Clang.cpp feat(lint): fixed-width-types keeps widths that a foreign API chose 2026-07-30 23:59:46 +02:00
Crafter.Build-External.cpp feat(lint): no-char-pointer reads the AST, retiring the interop denylist 2026-07-30 23:46:32 +02:00
Crafter.Build-Implementation.cpp linting 2026-07-23 01:24:42 +02:00
Crafter.Build-Interface.cpp fix: track what a primary module interface imports 2026-07-30 18:19:04 +00:00
Crafter.Build-Lint.cpp refactor(lint): single-declaration splits on the AST, per-declarator type 2026-07-31 00:35:52 +02:00
Crafter.Build-Platform.cpp fix: key the host PCM cache on source content, add clean, hash project args 2026-07-30 17:43:09 +00:00
Crafter.Build-Progress.cpp linting 2026-07-23 01:24:42 +02:00
Crafter.Build-Shader.cpp feat(lint): naming reads the AST, deleting the scope heuristic 2026-07-30 23:53:26 +02:00
Crafter.Build-Test.cpp fix: key the host PCM cache on source content, add clean, hash project args 2026-07-30 17:43:09 +00:00
main.cpp linting 2026-07-23 01:24:42 +02:00