## Summary
- **Public feature types**: Move `SemanticToken`, `FoldingRange`,
`DocumentSymbol`, `InlayHint`, and `HintCategory` from internal `.cpp`
files to `feature.h` as public API types. Each feature now exposes two
overloads: a raw overload returning offset-based types and a protocol
overload that converts to LSP wire-format with explicit
`PositionEncoding`.
- **Snapshot testing**: Add corpus-driven snapshot tests using
`ASSERT_SNAPSHOT_GLOB` for semantic tokens, folding ranges, inlay hints,
document symbols, and TU index. Tests compile real C++ corpus files,
format output as YAML flow mappings, and diff against `.snap.yml`
baselines.
- **Test infrastructure**: Add `compile_file()` to `Tester`,
`yaml_str()` utility, `--corpus-dir` / `--snapshot-dir` CLI options, and
`--verbose` flag for unit tests. Migrate to kotatsu's unified
`kota::zest::Options` API.
- **Toolchain robustness**: Filter unknown cc1 args via
`clang::driver::getDriverOptTable()` to handle system compilers newer
than embedded LLVM.
- **Dependency bump**: Update kotatsu to 7381404 (unified zest Options,
out-param `from_json` API).
## Details
### Feature type changes
All five feature modules (`semantic_tokens`, `folding_ranges`,
`document_symbols`, `inlay_hints`, `document_links`) now follow the same
two-overload pattern. The raw overload returns offset-based structs
suitable for indexing and testing; the protocol overload adds
`PositionEncoding` conversion for LSP responses. `stateful_worker.cpp`
explicitly passes `PositionEncoding::UTF16` at every call site.
### Snapshot tests
Corpus files live in `tests/corpus/` (organized by language construct).
Snapshot baselines live in `tests/snapshots/<feature>/`. Format lambdas
are inlined directly in test bodies — no separate format functions for
single-use formatters. YAML output uses flow mappings (`- { key: value
}`) for compact, diffable baselines.
### cc1 arg filtering
`src/command/toolchain.cpp` now parses the cc1 argument list through
LLVM's driver option table and drops any args classified as
`UnknownClass`. This prevents compilation failures when the system
compiler emits flags that the embedded LLVM version doesn't recognize.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
1.4 KiB
CMake
56 lines
1.4 KiB
CMake
include_guard()
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/llvm.cmake)
|
|
setup_llvm("21.1.8")
|
|
|
|
# install dependencies
|
|
include(FetchContent)
|
|
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
|
|
|
|
# spdlog
|
|
FetchContent_Declare(
|
|
spdlog
|
|
GIT_REPOSITORY https://github.com/gabime/spdlog.git
|
|
GIT_TAG v1.15.3
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
set(SPDLOG_USE_STD_FORMAT ON CACHE BOOL "" FORCE)
|
|
set(SPDLOG_NO_EXCEPTIONS ON CACHE BOOL "" FORCE)
|
|
|
|
# croaring
|
|
FetchContent_Declare(
|
|
croaring
|
|
GIT_REPOSITORY https://github.com/RoaringBitmap/CRoaring.git
|
|
GIT_TAG v4.4.2
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
set(ENABLE_ROARING_TESTS OFF CACHE INTERNAL "" FORCE)
|
|
set(ENABLE_ROARING_MICROBENCHMARKS OFF CACHE INTERNAL "" FORCE)
|
|
|
|
# flatbuffers
|
|
FetchContent_Declare(
|
|
flatbuffers
|
|
GIT_REPOSITORY https://github.com/google/flatbuffers.git
|
|
GIT_TAG v25.9.23
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
set(FLATBUFFERS_BUILD_GRPC OFF CACHE BOOL "" FORCE)
|
|
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
set(FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "" FORCE)
|
|
|
|
FetchContent_Declare(
|
|
kotatsu
|
|
GIT_REPOSITORY https://github.com/clice-io/kotatsu
|
|
GIT_TAG 73814044ce8142f4438a3028f44668675fc09fff
|
|
)
|
|
|
|
set(KOTA_ENABLE_ZEST ON)
|
|
set(KOTA_ENABLE_TEST OFF)
|
|
set(KOTA_CODEC_ENABLE_SIMDJSON ON)
|
|
set(KOTA_CODEC_ENABLE_YYJSON ON)
|
|
set(KOTA_CODEC_ENABLE_TOML ON)
|
|
set(KOTA_ENABLE_EXCEPTIONS OFF)
|
|
set(KOTA_ENABLE_RTTI OFF)
|
|
|
|
FetchContent_MakeAvailable(kotatsu spdlog croaring flatbuffers)
|