LUMIERA.clone/doc/technical
Ichthyostega 109d682408 Buildsystem: generate a compilation database for clangd (closes: #1436)
Knowledge-Technology(Claude Opus 5) used
 - to assess the situation and present implementation avenues
 - for discussion while shaping the solution
 - for generating code and validating results

Clang based tooling is used frequently for code analysis and navigation.
This requires however that the exact flags and invocation is captured for
each possible translation unit in the code base. That knowledge exists solely
in the build system, and the established way to hand it over is the
LLVM "JSON Compilation Database".

SCons has provided a `CompilationDatabase` builder since 4.0, and it fits
our setup well: it installs an emitter on the object builders and captures
each command line while the dependency graph is constructed. Hence nothing
is compiled -- generating takes about two seconds -- and the result always
describes the complete build graph as declared, rather than the target
actually requested on this invocation.

This feature is provided as ''opt-in'', either through the sticky option
`COMPILEDB=yes` or by direct invocation with `scons compiledb`

The `compile_commands.json` is generated into the build output `target/' dir
For configuration, a `.clangd` in project root instructs the language server
where to find this file.

__Note__ the ordering constraint recorded in `CompileDB.py`:
the emitter must be installed only after `Platform.configure()` has run,
or it also captures the `conftest_*` compilations of the configure checks.
That is why this is a plain helper invoked from the `SConstruct` -- similar to
Setup, Options, Platform -- and not a tool loaded from the `LumieraEnvironment`.
2026-10-01 01:08:23 +02:00
..
build Buildsystem: generate a compilation database for clangd (closes: #1436) 2026-10-01 01:08:23 +02:00
code Application: Adjustments to the Layer structure 2026-03-03 22:16:09 +01:00
howto Fix test breakage 2026-06-01 01:47:15 +02:00
infra Tests: build an link a test-support library 2026-03-06 23:16:32 +01:00
library Application: Adjustments to the Layer structure 2026-03-03 22:16:09 +01:00
stage Application: Adjustments to the Layer structure 2026-03-03 22:16:09 +01:00
steam Application: Adjustments to the Layer structure 2026-03-03 22:16:09 +01:00
vault clean-up: comb through the historical pages to fix markup errors 2025-09-21 05:40:15 +02:00
DIR_INFO update some DIR_INFO entries 2011-04-05 00:44:30 +02:00
index.txt Application: Adjustments to the Layer structure 2026-03-03 22:16:09 +01:00
overview.txt Application: Adjustments to the Layer structure 2026-03-03 22:16:09 +01:00