Changeset 109d682 in Lumiera

Timestamp:
2026-09-30T23:08:23Z (10 days ago)
Author:
Ichthyostega <prg@…>
Branches:
dev/play
Children:
0661b27
Parents:
595bb53
git-author:
Ichthyostega <prg@…> (01/10/26 21:22:36)
git-committer:
Ichthyostega <prg@…> (30/09/26 23:08:23)
Message:

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.

(No files)

Note: See TracChangeset for help on using the changeset viewer.