1 Commits

Author SHA1 Message Date
ykiko
1ec60f1c50 test(corpus): add if-statement corpus tests and snapshots
Add 9 new corpus files covering if-statement patterns: consteval,
constexpr, init-statements, structured bindings, declaration
conditions, null statements, and chaining. Generate snapshot
baselines for all 5 features.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-24 19:51:28 +08:00
71 changed files with 1973 additions and 269 deletions

3
.gitignore vendored
View File

@@ -68,7 +68,8 @@ tests/unit/Local/
.pixi/*
!.pixi/config.toml
.codex
.codex/
.claude/*
!.claude/CLAUDE.md
!.claude/commands/
openspec/

View File

@@ -124,31 +124,8 @@ if(CLICE_CI_ENVIRONMENT)
target_compile_definitions(clice_options INTERFACE CLICE_CI_ENVIRONMENT=1)
endif()
set(CLICE_CLANG_TIDY_MODULE_LIBRARIES)
set(CLICE_MISSING_CLANG_TIDY_MODULES)
foreach(module IN LISTS CLICE_CLANG_TIDY_MODULE_COMPONENTS)
find_library(CLICE_${module}_LIBRARY
NAMES "${module}"
PATHS "${LLVM_INSTALL_PATH}/lib"
NO_DEFAULT_PATH
)
if(CLICE_${module}_LIBRARY)
list(APPEND CLICE_CLANG_TIDY_MODULE_LIBRARIES "${CLICE_${module}_LIBRARY}")
else()
list(APPEND CLICE_MISSING_CLANG_TIDY_MODULES "${module}")
endif()
endforeach()
if(CLICE_MISSING_CLANG_TIDY_MODULES)
message(STATUS "Clang-tidy module libraries not available: ${CLICE_MISSING_CLANG_TIDY_MODULES}")
else()
target_compile_definitions(clice_options INTERFACE CLICE_HAS_CLANG_TIDY_MODULES=1)
endif()
set(FBS_SCHEMA_FILE "${PROJECT_SOURCE_DIR}/src/index/schema.fbs")
set(GENERATED_HEADER "${PROJECT_BINARY_DIR}/generated/schema_generated.h")
set(CLANG_TIDY_CONFIG_SOURCE_FILE "${PROJECT_SOURCE_DIR}/config/clang-tidy-config.h")
set(CLANG_TIDY_CONFIG_GENERATED_FILE "${PROJECT_BINARY_DIR}/generated/clang-tidy-config.h")
if(CMAKE_CROSSCOMPILING)
find_program(FLATC_EXECUTABLE flatc REQUIRED)
@@ -166,21 +143,10 @@ add_custom_command(
add_custom_target(generate_flatbuffers_schema DEPENDS "${GENERATED_HEADER}")
add_custom_command(
OUTPUT "${CLANG_TIDY_CONFIG_GENERATED_FILE}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CLANG_TIDY_CONFIG_SOURCE_FILE}"
"${CLANG_TIDY_CONFIG_GENERATED_FILE}"
DEPENDS "${CLANG_TIDY_CONFIG_SOURCE_FILE}"
COMMENT "Generating C++ header from ${CLANG_TIDY_CONFIG_SOURCE_FILE}"
)
add_custom_target(generate_clang_tidy_config DEPENDS "${CLANG_TIDY_CONFIG_GENERATED_FILE}")
file(GLOB_RECURSE CLICE_CORE_SOURCES CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.cpp")
add_library(clice-core STATIC ${CLICE_CORE_SOURCES})
add_library(clice::core ALIAS clice-core)
add_dependencies(clice-core generate_flatbuffers_schema generate_clang_tidy_config)
add_dependencies(clice-core generate_flatbuffers_schema)
target_include_directories(clice-core PUBLIC
"${PROJECT_SOURCE_DIR}/src"
@@ -196,9 +162,6 @@ target_link_libraries(clice-core PUBLIC
kota::codec::toml
simdjson::simdjson
)
if(CLICE_CLANG_TIDY_MODULE_LIBRARIES)
target_link_libraries(clice-core PUBLIC ${CLICE_CLANG_TIDY_MODULE_LIBRARIES})
endif()
add_executable(clice "${PROJECT_SOURCE_DIR}/src/clice.cc")
target_link_libraries(clice PRIVATE clice::core kota::deco)

View File

@@ -1,34 +1,5 @@
include_guard()
set(CLICE_CLANG_TIDY_MODULE_COMPONENTS
# Keep this in sync with scripts/llvm-components.json and the old
# ALL_CLANG_TIDY_CHECKS list. MPIModule is intentionally excluded because
# clice disables static analyzer checks in ClangTidyForceLinker.h.
clangTidyAndroidModule
clangTidyAbseilModule
clangTidyAlteraModule
clangTidyBoostModule
clangTidyBugproneModule
clangTidyCERTModule
clangTidyConcurrencyModule
clangTidyCppCoreGuidelinesModule
clangTidyDarwinModule
clangTidyFuchsiaModule
clangTidyGoogleModule
clangTidyHICPPModule
clangTidyLinuxKernelModule
clangTidyLLVMModule
clangTidyLLVMLibcModule
clangTidyMiscModule
clangTidyModernizeModule
clangTidyObjCModule
clangTidyOpenMPModule
clangTidyPerformanceModule
clangTidyPortabilityModule
clangTidyReadabilityModule
clangTidyZirconModule
)
function(setup_llvm LLVM_VERSION)
find_package(Python3 COMPONENTS Interpreter REQUIRED)
@@ -116,6 +87,29 @@ function(setup_llvm LLVM_VERSION)
clangSerialization
clangTidy
clangTidyUtils
clangTidyAndroidModule
clangTidyAbseilModule
clangTidyAlteraModule
clangTidyBoostModule
clangTidyBugproneModule
clangTidyCERTModule
clangTidyConcurrencyModule
clangTidyCppCoreGuidelinesModule
clangTidyDarwinModule
clangTidyFuchsiaModule
clangTidyGoogleModule
clangTidyHICPPModule
clangTidyLinuxKernelModule
clangTidyLLVMModule
clangTidyLLVMLibcModule
clangTidyMiscModule
clangTidyModernizeModule
clangTidyObjCModule
clangTidyOpenMPModule
clangTidyPerformanceModule
clangTidyPortabilityModule
clangTidyReadabilityModule
clangTidyZirconModule
clangTooling
clangToolingCore
clangToolingInclusions

View File

@@ -16,10 +16,7 @@ import subprocess
import time
from datetime import datetime, timezone
from pathlib import Path
from typing import Iterable, List, Optional, Set
LLVM_COMPONENTS_FILE = Path(__file__).with_name("llvm-components.json")
from typing import Iterable, List, Optional
def parse_args() -> argparse.Namespace:
@@ -105,33 +102,12 @@ def run_build(build_dir: Path) -> bool:
return False
def protected_library_names() -> Set[str]:
data = json.loads(LLVM_COMPONENTS_FILE.read_text())
components = data.get("components", [])
if not isinstance(components, list):
raise ValueError(f"{LLVM_COMPONENTS_FILE} missing 'components' list")
names: Set[str] = set()
for component in components:
if not isinstance(component, str):
continue
if not (component.startswith("clangTidy") and component.endswith("Module")):
continue
names.add(f"lib{component}.a")
names.add(f"{component}.lib")
return names
def candidate_files(install_dir: Path) -> Iterable[Path]:
if not install_dir.is_dir():
raise FileNotFoundError(f"lib dir not found: {install_dir}")
protected = protected_library_names()
for path in sorted(install_dir.iterdir()):
if not path.is_file():
continue
if path.name in protected:
print(f"Keeping protected clang-tidy module library: {path.name}")
continue
if path.suffix.lower() in {".a", ".lib"}:
yield path
else:
@@ -180,11 +156,7 @@ def apply_manifest(manifest: Path, install_dir: Path) -> None:
removed = data.get("removed", [])
if not isinstance(removed, list):
raise ValueError("Manifest missing 'removed' list")
protected = protected_library_names()
for name in removed:
if name in protected:
print(f"Keeping protected clang-tidy module library from manifest: {name}")
continue
target = install_dir / name
if target.exists():
print(f"Deleting {target}")

View File

@@ -53,7 +53,7 @@ struct Options {
help =
"Agentic method (compileCommand, symbolSearch, definition, references, "
"documentSymbols, readSymbol, callGraph, typeHierarchy, projectFiles, "
"lint, fileDeps, impactAnalysis, status, shutdown)",
"fileDeps, impactAnalysis, status, shutdown)",
required = false)
<std::string> method;

View File

@@ -418,8 +418,6 @@ CompilationUnit compile(CompilationParams& params, PCMInfo& out) {
}
CompilationUnit complete(CompilationParams& params, clang::CodeCompleteConsumer* consumer) {
params.kind = CompilationKind::Completion;
auto& [file, offset] = params.completion;
/// The location of clang is 1-1 based.

View File

@@ -65,7 +65,7 @@ struct PCMInfo : ModuleInfo {
struct CompilationParams {
/// The kind of this compilation.
CompilationKind kind = CompilationKind::Content;
CompilationKind kind;
/// Whether to run clang-tidy.
bool clang_tidy = false;

View File

@@ -12,10 +12,6 @@
#include "clang-tidy/ClangTidyDiagnosticConsumer.h"
#include "clang-tidy/ClangTidyModuleRegistry.h"
#include "clang-tidy/ClangTidyOptions.h"
#ifdef CLICE_HAS_CLANG_TIDY_MODULES
#define CLANG_TIDY_DISABLE_STATIC_ANALYZER_CHECKS
#include "clang-tidy/ClangTidyForceLinker.h"
#endif
namespace clice::tidy {

View File

@@ -34,34 +34,6 @@ bool is_dependent(const clang::Decl* D) {
return isa<clang::UnresolvedUsingValueDecl>(D);
}
/// Whether a declaration name is backed by source text that should be highlighted.
bool can_highlight_name(clang::DeclarationName name) {
switch(name.getNameKind()) {
case clang::DeclarationName::Identifier: {
auto* info = name.getAsIdentifierInfo();
return info && !info->getName().empty();
}
case clang::DeclarationName::CXXConstructorName:
case clang::DeclarationName::CXXDestructorName: {
return true;
}
case clang::DeclarationName::CXXConversionFunctionName:
case clang::DeclarationName::CXXOperatorName:
case clang::DeclarationName::CXXDeductionGuideName:
case clang::DeclarationName::CXXLiteralOperatorName:
case clang::DeclarationName::CXXUsingDirective:
case clang::DeclarationName::ObjCZeroArgSelector:
case clang::DeclarationName::ObjCOneArgSelector:
case clang::DeclarationName::ObjCMultiArgSelector: {
return false;
}
}
std::unreachable();
}
/// Returns true if `decl` is considered to be from a default/system library.
/// This currently checks the systemness of the file by include type, although
/// different heuristics may be used in the future (e.g. sysroot paths).
@@ -199,10 +171,6 @@ public:
void handleDeclOccurrence(const clang::NamedDecl* decl,
RelationKind relation,
clang::SourceLocation location) {
if(relation.isReference() && !can_highlight_name(decl->getDeclName())) {
return;
}
std::uint32_t modifiers = 0;
if(relation.is_one_of(RelationKind::Definition)) {
// todo: clangd add both Declaration and Definition modifiers for definitions.

View File

@@ -669,7 +669,6 @@ kota::task<> Compiler::run_compile(std::uint32_t pid, std::shared_ptr<Session::P
params.path = file_path;
params.version = sess->version;
params.text = sess->text;
params.clang_tidy = workspace.config.project.clang_tidy.value;
if(!fill_compile_args(file_path, params.directory, params.arguments, sess)) {
finish_compile();
co_return;

View File

@@ -5,7 +5,6 @@
#include <string>
#include <vector>
#include "kota/ipc/lsp/protocol.h"
#include "kota/ipc/protocol.h"
namespace clice::agentic {
@@ -203,13 +202,6 @@ struct TypeHierarchyResult {
std::vector<TypeHierarchyEntry> subtypes;
};
struct LintParams {
std::string path;
std::optional<int> line;
};
using LintResult = std::vector<kota::ipc::protocol::Diagnostic>;
struct StatusParams {};
struct StatusResult {
@@ -291,12 +283,6 @@ struct RequestTraits<clice::agentic::TypeHierarchyParams> {
constexpr inline static std::string_view method = "agentic/typeHierarchy";
};
template <>
struct RequestTraits<clice::agentic::LintParams> {
using Result = clice::agentic::LintResult;
constexpr inline static std::string_view method = "agentic/lint";
};
template <>
struct RequestTraits<clice::agentic::StatusParams> {
using Result = clice::agentic::StatusResult;

View File

@@ -43,7 +43,6 @@ struct CompileParams {
std::string text;
std::string directory;
std::vector<std::string> arguments;
bool clang_tidy = false;
std::pair<std::string, uint32_t> pch;
std::unordered_map<std::string, std::string> pcms;
};

View File

@@ -6,14 +6,11 @@
#include <string>
#include <vector>
#include "compile/compilation.h"
#include "feature/feature.h"
#include "server/protocol/agentic.h"
#include "server/service/master_server.h"
#include "support/filesystem.h"
#include "support/logging.h"
#include "kota/async/async.h"
#include "kota/ipc/lsp/uri.h"
#include "kota/meta/enum.h"
#include "llvm/ADT/DenseSet.h"
@@ -772,36 +769,6 @@ AgentClient::AgentClient(MasterServer& server, kota::ipc::JsonPeer& peer) :
co_return result;
});
peer.on_request([&srv](RequestContext&, const LintParams& params) -> RequestResult<LintParams> {
std::string directory;
std::vector<std::string> arguments;
if(!srv.compiler.fill_compile_args(params.path, directory, arguments)) {
co_return kota::outcome_error(
kota::ipc::Error{std::format("no compile command found for {}", params.path)});
}
auto result = co_await kota::queue([path = params.path,
directory = std::move(directory),
arguments = std::move(arguments)]() mutable {
CompilationParams cp;
cp.kind = CompilationKind::Content;
cp.clang_tidy = true;
cp.directory = std::move(directory);
for(auto& arg: arguments) {
cp.arguments.push_back(arg.c_str());
}
auto unit = compile(cp);
if(!unit.completed() && !unit.fatal_error()) {
LOG_WARN("Lint compilation failed: {}", path);
return LintResult{};
}
return feature::diagnostics(unit);
});
co_return result.value();
});
peer.on_request([&srv](RequestContext&, const StatusParams&) -> RequestResult<StatusParams> {
StatusResult result;
result.idle = srv.indexer.is_idle();

View File

@@ -85,9 +85,6 @@ static kota::task<> agentic_request(kota::ipc::JsonPeer& peer,
.line = line,
.direction = dir,
});
} else if(opts.method == "lint") {
auto line = opts.line > 0 ? std::optional(opts.line) : std::nullopt;
ok = co_await send_and_print(peer, agentic::LintParams{.path = opts.path, .line = line});
} else if(opts.method == "fileDeps") {
auto dir = opts.direction.empty() ? std::nullopt : std::optional(opts.direction);
ok = co_await send_and_print(peer,

View File

@@ -152,7 +152,6 @@ void StatefulWorker::register_handlers() {
CompilationParams cp;
cp.kind = CompilationKind::Content;
cp.clang_tidy = params.clang_tidy;
fill_args(cp, doc->directory, doc->arguments);
if(!doc->pch.first.empty()) {
cp.pch = doc->pch;

View File

@@ -0,0 +1,49 @@
// if-else chain patterns and compound conditions
namespace if_chain {
int classify_char(char c) {
if(c >= 'a' && c <= 'z')
return 1; // lowercase
else if(c >= 'A' && c <= 'Z')
return 2; // uppercase
else if(c >= '0' && c <= '9')
return 3; // digit
else
return 0; // other
}
// early return pattern
bool validate(int x, int y, int z) {
if(x < 0)
return false;
if(y < 0)
return false;
if(z < 0)
return false;
if(x + y + z > 100)
return false;
return true;
}
// if with compound statement and multiple effects
int process(int* data, int size) {
int sum = 0;
for(int i = 0; i < size; ++i) {
if(data[i] > 0) {
sum += data[i];
data[i] = 0;
} else if(data[i] < -10) {
sum -= data[i];
}
}
return sum;
}
void test() {
[[maybe_unused]] int r1 = classify_char('a');
[[maybe_unused]] bool r2 = validate(1, 2, 3);
int arr[] = {1, -20, 3, -5};
[[maybe_unused]] int r3 = process(arr, 4);
}
} // namespace if_chain

View File

@@ -0,0 +1,46 @@
// C++23 if consteval
namespace if_consteval {
constexpr int compute(int x) {
if consteval {
return x * x; // compile-time path
} else {
return x + x; // runtime path
}
}
// negated form: if !consteval
constexpr int runtime_prefer(int x) {
if !consteval {
return x + 1; // runtime path
} else {
return x - 1; // compile-time path
}
}
// consteval function callable only at compile time
consteval int ct_only(int x) {
return x * 3;
}
constexpr int dispatch(int x) {
if consteval {
return ct_only(x); // OK: in immediate context
} else {
return x;
}
}
// if consteval without else
constexpr int maybe_optimize(int x) {
if consteval {
return x * x * x;
}
return x;
}
static_assert(compute(5) == 25);
static_assert(dispatch(3) == 9);
static_assert(maybe_optimize(4) == 64);
} // namespace if_consteval

View File

@@ -0,0 +1,38 @@
// if constexpr: basic compile-time branching
namespace if_constexpr_basic {
template <typename T>
constexpr int type_rank() {
if constexpr(__is_same(T, char)) {
return 1;
} else if constexpr(__is_same(T, int)) {
return 2;
} else if constexpr(__is_same(T, long long)) {
return 3;
} else {
return 0;
}
}
static_assert(type_rank<char>() == 1);
static_assert(type_rank<int>() == 2);
static_assert(type_rank<long long>() == 3);
static_assert(type_rank<float>() == 0);
// discarded branch not instantiated
template <typename T>
auto dereference(T val) {
if constexpr(__is_pointer(T)) {
return *val;
} else {
return val;
}
}
void test() {
int x = 42;
[[maybe_unused]] int r1 = dereference(&x);
[[maybe_unused]] int r2 = dereference(x);
}
} // namespace if_constexpr_basic

View File

@@ -0,0 +1,37 @@
// if constexpr with requires-expression
namespace if_constexpr_requires {
template <typename T>
int get_length(const T& x) {
if constexpr(requires { x.size(); }) {
return static_cast<int>(x.size());
} else if constexpr(requires { x.length; }) {
return x.length;
} else {
return 1;
}
}
struct WithLength {
int length;
};
struct Container {
int data[4];
int size() const {
return 4;
}
};
void test() {
Container c{};
[[maybe_unused]] int r1 = get_length(c);
WithLength wl{10};
[[maybe_unused]] int r2 = get_length(wl);
[[maybe_unused]] int r3 = get_length(42);
}
} // namespace if_constexpr_requires

View File

@@ -0,0 +1,35 @@
// if constexpr with variadic templates
namespace if_constexpr_variadic {
// recursive fold with if constexpr
template <typename T, typename... Rest>
constexpr T sum(T first, Rest... rest) {
if constexpr(sizeof...(rest) == 0) {
return first;
} else {
return first + sum(rest...);
}
}
static_assert(sum(1) == 1);
static_assert(sum(1, 2, 3) == 6);
static_assert(sum(1, 2, 3, 4, 5) == 15);
// process each element differently
template <typename T>
constexpr int count_one() {
if constexpr(__is_integral(T)) {
return 1;
} else {
return 0;
}
}
template <typename... Ts>
constexpr int count_integrals() {
return (count_one<Ts>() + ...);
}
static_assert(count_integrals<int, float, char, double>() == 2);
} // namespace if_constexpr_variadic

View File

@@ -0,0 +1,47 @@
// if with declaration as condition
namespace if_declaration {
struct Optional {
int value;
bool valid;
explicit operator bool() const {
return valid;
}
};
Optional try_parse(int x) {
if(x >= 0)
return {x * 2, true};
return {0, false};
}
int use_declaration_condition(int x) {
if(Optional result = try_parse(x)) {
return result.value;
}
return -1;
}
// pointer declaration as condition
struct Node {
int data;
Node* next;
};
int walk_list(Node* head) {
int sum = 0;
if(Node* p = head) {
sum += p->data;
}
return sum;
}
void test() {
[[maybe_unused]] int r1 = use_declaration_condition(5);
[[maybe_unused]] int r2 = use_declaration_condition(-1);
Node n{42, nullptr};
[[maybe_unused]] int r3 = walk_list(&n);
}
} // namespace if_declaration

View File

@@ -0,0 +1,49 @@
// C++17 if with init-statement
namespace if_init {
struct Result {
int value;
bool ok;
};
Result compute(int x) {
if(x > 0)
return {x * 10, true};
return {0, false};
}
int with_init(int x) {
if(auto r = compute(x); r.ok) {
return r.value;
}
return -1;
}
// init-statement with array
bool find_char(const char* str, char target) {
if(int i = 0; str) {
while(str[i]) {
if(str[i] == target)
return true;
++i;
}
}
return false;
}
// init-statement scoping: variables not visible outside
int scoping_demo(int x) {
if(int doubled = x * 2; doubled > 10) {
return doubled;
} else {
return doubled + 1; // doubled visible in else
}
}
void test() {
[[maybe_unused]] int r1 = with_init(5);
[[maybe_unused]] bool r2 = find_char("hello", 'l');
[[maybe_unused]] int r3 = scoping_demo(3);
}
} // namespace if_init

View File

@@ -0,0 +1,46 @@
// if with init-statement using structured bindings
namespace if_init_sb {
struct Pair {
int first;
int second;
};
Pair divide(int a, int b) {
if(b == 0)
return {0, 0};
return {a / b, a % b};
}
int safe_divide(int a, int b) {
if(auto [quot, rem] = divide(a, b); b != 0) {
return quot;
}
return -1;
}
struct ParseResult {
bool success;
int value;
const char* error;
};
ParseResult parse(int x) {
if(x < 0)
return {false, 0, "negative"};
return {true, x, nullptr};
}
int try_parse(int x) {
if(auto [ok, val, err] = parse(x); ok) {
return val;
}
return 0;
}
void test() {
[[maybe_unused]] int r1 = safe_divide(10, 3);
[[maybe_unused]] int r2 = try_parse(42);
}
} // namespace if_init_sb

View File

@@ -0,0 +1,40 @@
// if with null statement and single-statement bodies
namespace if_null {
// null init-statement in C++17 if
int with_null_init(int x) {
if(; x > 0) {
return x;
}
return 0;
}
// single statement body (no braces)
int single_stmt(int x) {
if(x > 10)
return x;
if(x > 5)
return x + 1;
return 0;
}
// scope of variable declared in if body
void scope_test() {
if(true) {
[[maybe_unused]] int x = 42;
}
// x is out of scope here
if(int y = 10; y > 0) {
[[maybe_unused]] int z = y;
}
// y and z are out of scope here
}
void test() {
[[maybe_unused]] int r1 = with_null_init(5);
[[maybe_unused]] int r2 = single_stmt(7);
scope_test();
}
} // namespace if_null

View File

@@ -0,0 +1,17 @@
---
source: document_symbol_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_chain_patterns.cpp
---
- { name: "if_chain", kind: Namespace, range: "1:0-48:1", selection_range: "1:10-1:18" }
- { name: "classify_char", kind: Function, range: "3:0-12:1", selection_range: "3:4-3:17", detail: "int (char)" }
- { name: "validate", kind: Function, range: "15:0-25:1", selection_range: "15:5-15:13", detail: "bool (int, int, int)" }
- { name: "process", kind: Function, range: "28:0-39:1", selection_range: "28:4-28:11", detail: "int (int *, int)" }
- { name: "sum", kind: Variable, range: "29:4-29:15", selection_range: "29:8-29:11", detail: "int" }
- { name: "i", kind: Variable, range: "30:8-30:17", selection_range: "30:12-30:13", detail: "int" }
- { name: "test", kind: Function, range: "41:0-46:1", selection_range: "41:5-41:9", detail: "void ()" }
- { name: "r1", kind: Variable, range: "42:21-42:48", selection_range: "42:25-42:27", detail: "int" }
- { name: "r2", kind: Variable, range: "43:21-43:48", selection_range: "43:26-43:28", detail: "bool" }
- { name: "arr", kind: Variable, range: "44:4-44:31", selection_range: "44:8-44:11", detail: "int[4]" }
- { name: "r3", kind: Variable, range: "45:21-45:45", selection_range: "45:25-45:27", detail: "int" }

View File

@@ -0,0 +1,12 @@
---
source: document_symbol_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_consteval.cpp
---
- { name: "if_consteval", kind: Namespace, range: "1:0-45:1", selection_range: "1:10-1:22" }
- { name: "compute", kind: Function, range: "3:0-9:1", selection_range: "3:14-3:21", detail: "int (int)" }
- { name: "runtime_prefer", kind: Function, range: "12:0-18:1", selection_range: "12:14-12:28", detail: "int (int)" }
- { name: "ct_only", kind: Function, range: "21:0-23:1", selection_range: "21:14-21:21", detail: "int (int)" }
- { name: "dispatch", kind: Function, range: "25:0-31:1", selection_range: "25:14-25:22", detail: "int (int)" }
- { name: "maybe_optimize", kind: Function, range: "34:0-39:1", selection_range: "34:14-34:28", detail: "int (int)" }

View File

@@ -0,0 +1,13 @@
---
source: document_symbol_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_basic.cpp
---
- { name: "if_constexpr_basic", kind: Namespace, range: "1:0-37:1", selection_range: "1:10-1:28" }
- { name: "type_rank", kind: Function, range: "4:0-14:1", selection_range: "4:14-4:23", detail: "template int ()" }
- { name: "dereference", kind: Function, range: "23:0-29:1", selection_range: "23:5-23:16", detail: "template auto (T)" }
- { name: "test", kind: Function, range: "31:0-35:1", selection_range: "31:5-31:9", detail: "void ()" }
- { name: "x", kind: Variable, range: "32:4-32:14", selection_range: "32:8-32:9", detail: "int" }
- { name: "r1", kind: Variable, range: "33:21-33:45", selection_range: "33:25-33:27", detail: "int" }
- { name: "r2", kind: Variable, range: "34:21-34:44", selection_range: "34:25-34:27", detail: "int" }

View File

@@ -0,0 +1,19 @@
---
source: document_symbol_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_requires.cpp
---
- { name: "if_constexpr_requires", kind: Namespace, range: "1:0-36:1", selection_range: "1:10-1:31" }
- { name: "get_length", kind: Function, range: "4:0-12:1", selection_range: "4:4-4:14", detail: "template int (const T &)" }
- { name: "WithLength", kind: Struct, range: "14:0-16:1", selection_range: "14:7-14:17", detail: "struct" }
- { name: "length", kind: Field, range: "15:4-15:14", selection_range: "15:8-15:14", detail: "int" }
- { name: "Container", kind: Struct, range: "18:0-24:1", selection_range: "18:7-18:16", detail: "struct" }
- { name: "data", kind: Field, range: "19:4-19:15", selection_range: "19:8-19:12", detail: "int[4]" }
- { name: "size", kind: Method, range: "21:4-23:5", selection_range: "21:8-21:12", detail: "int () const" }
- { name: "test", kind: Function, range: "26:0-34:1", selection_range: "26:5-26:9", detail: "void ()" }
- { name: "c", kind: Variable, range: "27:4-27:17", selection_range: "27:14-27:15", detail: "Container" }
- { name: "r1", kind: Variable, range: "28:21-28:43", selection_range: "28:25-28:27", detail: "int" }
- { name: "wl", kind: Variable, range: "30:4-30:21", selection_range: "30:15-30:17", detail: "WithLength" }
- { name: "r2", kind: Variable, range: "31:21-31:44", selection_range: "31:25-31:27", detail: "int" }
- { name: "r3", kind: Variable, range: "33:21-33:44", selection_range: "33:25-33:27", detail: "int" }

View File

@@ -0,0 +1,10 @@
---
source: document_symbol_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_variadic.cpp
---
- { name: "if_constexpr_variadic", kind: Namespace, range: "1:0-34:1", selection_range: "1:10-1:31" }
- { name: "sum", kind: Function, range: "5:0-11:1", selection_range: "5:12-5:15", detail: "template T (T, Rest...)" }
- { name: "count_one", kind: Function, range: "19:0-25:1", selection_range: "19:14-19:23", detail: "template int ()" }
- { name: "count_integrals", kind: Function, range: "28:0-30:1", selection_range: "28:14-28:29", detail: "template int ()" }

View File

@@ -0,0 +1,25 @@
---
source: document_symbol_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_declaration_condition.cpp
---
- { name: "if_declaration", kind: Namespace, range: "1:0-46:1", selection_range: "1:10-1:24" }
- { name: "Optional", kind: Struct, range: "3:0-10:1", selection_range: "3:7-3:15", detail: "struct" }
- { name: "value", kind: Field, range: "4:4-4:13", selection_range: "4:8-4:13", detail: "int" }
- { name: "valid", kind: Field, range: "5:4-5:14", selection_range: "5:9-5:14", detail: "bool" }
- { name: "operator bool", kind: Method, range: "7:4-9:5", selection_range: "7:13-7:21", detail: "bool () const" }
- { name: "try_parse", kind: Function, range: "12:0-16:1", selection_range: "12:9-12:18", detail: "Optional (int)" }
- { name: "use_declaration_condition", kind: Function, range: "18:0-23:1", selection_range: "18:4-18:29", detail: "int (int)" }
- { name: "result", kind: Variable, range: "19:7-19:37", selection_range: "19:16-19:22", detail: "Optional" }
- { name: "Node", kind: Struct, range: "26:0-29:1", selection_range: "26:7-26:11", detail: "struct" }
- { name: "data", kind: Field, range: "27:4-27:12", selection_range: "27:8-27:12", detail: "int" }
- { name: "next", kind: Field, range: "28:4-28:14", selection_range: "28:10-28:14", detail: "Node *" }
- { name: "walk_list", kind: Function, range: "31:0-37:1", selection_range: "31:4-31:13", detail: "int (Node *)" }
- { name: "sum", kind: Variable, range: "32:4-32:15", selection_range: "32:8-32:11", detail: "int" }
- { name: "p", kind: Variable, range: "33:7-33:21", selection_range: "33:13-33:14", detail: "Node *" }
- { name: "test", kind: Function, range: "39:0-44:1", selection_range: "39:5-39:9", detail: "void ()" }
- { name: "r1", kind: Variable, range: "40:21-40:58", selection_range: "40:25-40:27", detail: "int" }
- { name: "r2", kind: Variable, range: "41:21-41:59", selection_range: "41:25-41:27", detail: "int" }
- { name: "n", kind: Variable, range: "42:4-42:23", selection_range: "42:9-42:10", detail: "Node" }
- { name: "r3", kind: Variable, range: "43:21-43:43", selection_range: "43:25-43:27", detail: "int" }

View File

@@ -0,0 +1,21 @@
---
source: document_symbol_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_statement.cpp
---
- { name: "if_init", kind: Namespace, range: "1:0-48:1", selection_range: "1:10-1:17" }
- { name: "Result", kind: Struct, range: "3:0-6:1", selection_range: "3:7-3:13", detail: "struct" }
- { name: "value", kind: Field, range: "4:4-4:13", selection_range: "4:8-4:13", detail: "int" }
- { name: "ok", kind: Field, range: "5:4-5:11", selection_range: "5:9-5:11", detail: "bool" }
- { name: "compute", kind: Function, range: "8:0-12:1", selection_range: "8:7-8:14", detail: "Result (int)" }
- { name: "with_init", kind: Function, range: "14:0-19:1", selection_range: "14:4-14:13", detail: "int (int)" }
- { name: "r", kind: Variable, range: "15:7-15:26", selection_range: "15:12-15:13", detail: "Result" }
- { name: "find_char", kind: Function, range: "22:0-31:1", selection_range: "22:5-22:14", detail: "bool (const char *, char)" }
- { name: "i", kind: Variable, range: "23:7-23:16", selection_range: "23:11-23:12", detail: "int" }
- { name: "scoping_demo", kind: Function, range: "34:0-40:1", selection_range: "34:4-34:16", detail: "int (int)" }
- { name: "doubled", kind: Variable, range: "35:7-35:26", selection_range: "35:11-35:18", detail: "int" }
- { name: "test", kind: Function, range: "42:0-46:1", selection_range: "42:5-42:9", detail: "void ()" }
- { name: "r1", kind: Variable, range: "43:21-43:42", selection_range: "43:25-43:27", detail: "int" }
- { name: "r2", kind: Variable, range: "44:21-44:54", selection_range: "44:26-44:28", detail: "bool" }
- { name: "r3", kind: Variable, range: "45:21-45:45", selection_range: "45:25-45:27", detail: "int" }

View File

@@ -0,0 +1,26 @@
---
source: document_symbol_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_structured_binding.cpp
---
- { name: "if_init_sb", kind: Namespace, range: "1:0-45:1", selection_range: "1:10-1:20" }
- { name: "Pair", kind: Struct, range: "3:0-6:1", selection_range: "3:7-3:11", detail: "struct" }
- { name: "first", kind: Field, range: "4:4-4:13", selection_range: "4:8-4:13", detail: "int" }
- { name: "second", kind: Field, range: "5:4-5:14", selection_range: "5:8-5:14", detail: "int" }
- { name: "divide", kind: Function, range: "8:0-12:1", selection_range: "8:5-8:11", detail: "Pair (int, int)" }
- { name: "safe_divide", kind: Function, range: "14:0-19:1", selection_range: "14:4-14:15", detail: "int (int, int)" }
- { name: "quot", kind: Variable, range: "15:13-15:17", selection_range: "15:13-15:17", detail: "int" }
- { name: "rem", kind: Variable, range: "15:19-15:22", selection_range: "15:19-15:22", detail: "int" }
- { name: "ParseResult", kind: Struct, range: "21:0-25:1", selection_range: "21:7-21:18", detail: "struct" }
- { name: "success", kind: Field, range: "22:4-22:16", selection_range: "22:9-22:16", detail: "bool" }
- { name: "value", kind: Field, range: "23:4-23:13", selection_range: "23:8-23:13", detail: "int" }
- { name: "error", kind: Field, range: "24:4-24:21", selection_range: "24:16-24:21", detail: "const char *" }
- { name: "parse", kind: Function, range: "27:0-31:1", selection_range: "27:12-27:17", detail: "ParseResult (int)" }
- { name: "try_parse", kind: Function, range: "33:0-38:1", selection_range: "33:4-33:13", detail: "int (int)" }
- { name: "ok", kind: Variable, range: "34:13-34:15", selection_range: "34:13-34:15", detail: "bool" }
- { name: "val", kind: Variable, range: "34:17-34:20", selection_range: "34:17-34:20", detail: "int" }
- { name: "err", kind: Variable, range: "34:22-34:25", selection_range: "34:22-34:25", detail: "const char *" }
- { name: "test", kind: Function, range: "40:0-43:1", selection_range: "40:5-40:9", detail: "void ()" }
- { name: "r1", kind: Variable, range: "41:21-41:48", selection_range: "41:25-41:27", detail: "int" }
- { name: "r2", kind: Variable, range: "42:21-42:43", selection_range: "42:25-42:27", detail: "int" }

View File

@@ -0,0 +1,16 @@
---
source: document_symbol_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_null_statement.cpp
---
- { name: "if_null", kind: Namespace, range: "1:0-39:1", selection_range: "1:10-1:17" }
- { name: "with_null_init", kind: Function, range: "4:0-9:1", selection_range: "4:4-4:18", detail: "int (int)" }
- { name: "single_stmt", kind: Function, range: "12:0-18:1", selection_range: "12:4-12:15", detail: "int (int)" }
- { name: "scope_test", kind: Function, range: "21:0-31:1", selection_range: "21:5-21:15", detail: "void ()" }
- { name: "x", kind: Variable, range: "23:25-23:35", selection_range: "23:29-23:30", detail: "int" }
- { name: "y", kind: Variable, range: "27:7-27:17", selection_range: "27:11-27:12", detail: "int" }
- { name: "z", kind: Variable, range: "28:25-28:34", selection_range: "28:29-28:30", detail: "int" }
- { name: "test", kind: Function, range: "33:0-37:1", selection_range: "33:5-33:9", detail: "void ()" }
- { name: "r1", kind: Variable, range: "34:21-34:47", selection_range: "34:25-34:27", detail: "int" }
- { name: "r2", kind: Variable, range: "35:21-35:44", selection_range: "35:25-35:27", detail: "int" }

View File

@@ -0,0 +1,11 @@
---
source: folding_range_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_chain_patterns.cpp
---
- { range: "1:19-48:1", kind: namespace, collapsed_text: "{...}" }
- { range: "3:26-12:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "15:35-25:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "28:33-39:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "41:12-46:1", kind: functionBody, collapsed_text: "{...}" }

View File

@@ -0,0 +1,12 @@
---
source: folding_range_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_consteval.cpp
---
- { range: "1:23-45:1", kind: namespace, collapsed_text: "{...}" }
- { range: "3:29-9:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "12:36-18:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "21:29-23:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "25:30-31:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "34:36-39:1", kind: functionBody, collapsed_text: "{...}" }

View File

@@ -0,0 +1,10 @@
---
source: folding_range_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_basic.cpp
---
- { range: "1:29-37:1", kind: namespace, collapsed_text: "{...}" }
- { range: "4:26-14:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "23:24-29:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "31:12-35:1", kind: functionBody, collapsed_text: "{...}" }

View File

@@ -0,0 +1,12 @@
---
source: folding_range_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_requires.cpp
---
- { range: "1:32-36:1", kind: namespace, collapsed_text: "{...}" }
- { range: "4:27-12:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "14:18-16:1", kind: struct, collapsed_text: "{...}" }
- { range: "18:17-24:1", kind: struct, collapsed_text: "{...}" }
- { range: "21:21-23:5", kind: functionBody, collapsed_text: "{...}" }
- { range: "26:12-34:1", kind: functionBody, collapsed_text: "{...}" }

View File

@@ -0,0 +1,10 @@
---
source: folding_range_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_variadic.cpp
---
- { range: "1:32-34:1", kind: namespace, collapsed_text: "{...}" }
- { range: "5:39-11:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "19:26-25:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "28:32-30:1", kind: functionBody, collapsed_text: "{...}" }

View File

@@ -0,0 +1,14 @@
---
source: folding_range_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_declaration_condition.cpp
---
- { range: "1:25-46:1", kind: namespace, collapsed_text: "{...}" }
- { range: "3:16-10:1", kind: struct, collapsed_text: "{...}" }
- { range: "7:35-9:5", kind: functionBody, collapsed_text: "{...}" }
- { range: "12:26-16:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "18:37-23:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "26:12-29:1", kind: struct, collapsed_text: "{...}" }
- { range: "31:26-37:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "39:12-44:1", kind: functionBody, collapsed_text: "{...}" }

View File

@@ -0,0 +1,13 @@
---
source: folding_range_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_statement.cpp
---
- { range: "1:18-48:1", kind: namespace, collapsed_text: "{...}" }
- { range: "3:14-6:1", kind: struct, collapsed_text: "{...}" }
- { range: "8:22-12:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "14:21-19:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "22:45-31:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "34:24-40:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "42:12-46:1", kind: functionBody, collapsed_text: "{...}" }

View File

@@ -0,0 +1,14 @@
---
source: folding_range_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_structured_binding.cpp
---
- { range: "1:21-45:1", kind: namespace, collapsed_text: "{...}" }
- { range: "3:12-6:1", kind: struct, collapsed_text: "{...}" }
- { range: "8:26-12:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "14:30-19:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "21:19-25:1", kind: struct, collapsed_text: "{...}" }
- { range: "27:25-31:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "33:21-38:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "40:12-43:1", kind: functionBody, collapsed_text: "{...}" }

View File

@@ -0,0 +1,11 @@
---
source: folding_range_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_null_statement.cpp
---
- { range: "1:18-39:1", kind: namespace, collapsed_text: "{...}" }
- { range: "4:26-9:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "12:23-18:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "21:18-31:1", kind: functionBody, collapsed_text: "{...}" }
- { range: "33:12-37:1", kind: functionBody, collapsed_text: "{...}" }

View File

@@ -0,0 +1,12 @@
---
source: inlay_hint_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_chain_patterns.cpp
---
- { pos: "42:44", kind: Parameter, label: "c:", padding_right: true }
- { pos: "43:40", kind: Parameter, label: "x:", padding_right: true }
- { pos: "43:43", kind: Parameter, label: "y:", padding_right: true }
- { pos: "43:46", kind: Parameter, label: "z:", padding_right: true }
- { pos: "45:38", kind: Parameter, label: "data:", padding_right: true }
- { pos: "45:43", kind: Parameter, label: "size:", padding_right: true }

View File

@@ -0,0 +1,9 @@
---
source: inlay_hint_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_consteval.cpp
---
- { pos: "41:22", kind: Parameter, label: "x:", padding_right: true }
- { pos: "42:23", kind: Parameter, label: "x:", padding_right: true }
- { pos: "43:29", kind: Parameter, label: "x:", padding_right: true }

View File

@@ -0,0 +1,8 @@
---
source: inlay_hint_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_basic.cpp
---
- { pos: "33:42", kind: Parameter, label: "val:", padding_right: true }
- { pos: "34:42", kind: Parameter, label: "val:", padding_right: true }

View File

@@ -0,0 +1,9 @@
---
source: inlay_hint_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_requires.cpp
---
- { pos: "28:41", kind: Parameter, label: "x:", padding_right: true }
- { pos: "31:41", kind: Parameter, label: "x:", padding_right: true }
- { pos: "33:41", kind: Parameter, label: "x:", padding_right: true }

View File

@@ -0,0 +1,9 @@
---
source: inlay_hint_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_variadic.cpp
---
- { pos: "13:18", kind: Parameter, label: "first:", padding_right: true }
- { pos: "14:18", kind: Parameter, label: "first:", padding_right: true }
- { pos: "15:18", kind: Parameter, label: "first:", padding_right: true }

View File

@@ -0,0 +1,9 @@
---
source: inlay_hint_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_declaration_condition.cpp
---
- { pos: "40:56", kind: Parameter, label: "x:", padding_right: true }
- { pos: "41:56", kind: Parameter, label: "x:", padding_right: true }
- { pos: "43:40", kind: Parameter, label: "head:", padding_right: true }

View File

@@ -0,0 +1,11 @@
---
source: inlay_hint_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_statement.cpp
---
- { pos: "15:13", kind: Type, label: ": Result" }
- { pos: "43:40", kind: Parameter, label: "x:", padding_right: true }
- { pos: "44:41", kind: Parameter, label: "str:", padding_right: true }
- { pos: "44:50", kind: Parameter, label: "target:", padding_right: true }
- { pos: "45:43", kind: Parameter, label: "x:", padding_right: true }

View File

@@ -0,0 +1,14 @@
---
source: inlay_hint_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_structured_binding.cpp
---
- { pos: "15:17", kind: Type, label: ": int" }
- { pos: "15:22", kind: Type, label: ": int" }
- { pos: "34:15", kind: Type, label: ": bool" }
- { pos: "34:20", kind: Type, label: ": int" }
- { pos: "34:25", kind: Type, label: ": const char *" }
- { pos: "41:42", kind: Parameter, label: "a:", padding_right: true }
- { pos: "41:46", kind: Parameter, label: "b:", padding_right: true }
- { pos: "42:40", kind: Parameter, label: "x:", padding_right: true }

View File

@@ -0,0 +1,8 @@
---
source: inlay_hint_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_null_statement.cpp
---
- { pos: "34:45", kind: Parameter, label: "x:", padding_right: true }
- { pos: "35:42", kind: Parameter, label: "x:", padding_right: true }

View File

@@ -0,0 +1,137 @@
---
source: semantic_tokens_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_chain_patterns.cpp
---
- { loc: "0:0", text: "// if-else chain patterns and compound conditions", kind: Comment }
- { loc: "1:0", text: "namespace", kind: Keyword }
- { loc: "1:10", text: "if_chain", kind: Namespace, modifiers: [Definition] }
- { loc: "3:0", text: "int", kind: Keyword }
- { loc: "3:4", text: "classify_char", kind: Function, modifiers: [Definition] }
- { loc: "3:18", text: "char", kind: Keyword }
- { loc: "3:23", text: "c", kind: Parameter, modifiers: [Definition] }
- { loc: "4:4", text: "if", kind: Keyword }
- { loc: "4:7", text: "c", kind: Parameter }
- { loc: "4:12", text: "'a'", kind: Character }
- { loc: "4:19", text: "c", kind: Parameter }
- { loc: "4:24", text: "'z'", kind: Character }
- { loc: "5:8", text: "return", kind: Keyword }
- { loc: "5:15", text: "1", kind: Number }
- { loc: "5:19", text: "// lowercase", kind: Comment }
- { loc: "6:4", text: "else", kind: Keyword }
- { loc: "6:9", text: "if", kind: Keyword }
- { loc: "6:12", text: "c", kind: Parameter }
- { loc: "6:17", text: "'A'", kind: Character }
- { loc: "6:24", text: "c", kind: Parameter }
- { loc: "6:29", text: "'Z'", kind: Character }
- { loc: "7:8", text: "return", kind: Keyword }
- { loc: "7:15", text: "2", kind: Number }
- { loc: "7:19", text: "// uppercase", kind: Comment }
- { loc: "8:4", text: "else", kind: Keyword }
- { loc: "8:9", text: "if", kind: Keyword }
- { loc: "8:12", text: "c", kind: Parameter }
- { loc: "8:17", text: "'0'", kind: Character }
- { loc: "8:24", text: "c", kind: Parameter }
- { loc: "8:29", text: "'9'", kind: Character }
- { loc: "9:8", text: "return", kind: Keyword }
- { loc: "9:15", text: "3", kind: Number }
- { loc: "9:19", text: "// digit", kind: Comment }
- { loc: "10:4", text: "else", kind: Keyword }
- { loc: "11:8", text: "return", kind: Keyword }
- { loc: "11:15", text: "0", kind: Number }
- { loc: "11:19", text: "// other", kind: Comment }
- { loc: "14:0", text: "// early return pattern", kind: Comment }
- { loc: "15:0", text: "bool", kind: Keyword }
- { loc: "15:5", text: "validate", kind: Function, modifiers: [Definition] }
- { loc: "15:14", text: "int", kind: Keyword }
- { loc: "15:18", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "15:21", text: "int", kind: Keyword }
- { loc: "15:25", text: "y", kind: Parameter, modifiers: [Definition] }
- { loc: "15:28", text: "int", kind: Keyword }
- { loc: "15:32", text: "z", kind: Parameter, modifiers: [Definition] }
- { loc: "16:4", text: "if", kind: Keyword }
- { loc: "16:7", text: "x", kind: Parameter }
- { loc: "16:11", text: "0", kind: Number }
- { loc: "17:8", text: "return", kind: Keyword }
- { loc: "17:15", text: "false", kind: Keyword }
- { loc: "18:4", text: "if", kind: Keyword }
- { loc: "18:7", text: "y", kind: Parameter }
- { loc: "18:11", text: "0", kind: Number }
- { loc: "19:8", text: "return", kind: Keyword }
- { loc: "19:15", text: "false", kind: Keyword }
- { loc: "20:4", text: "if", kind: Keyword }
- { loc: "20:7", text: "z", kind: Parameter }
- { loc: "20:11", text: "0", kind: Number }
- { loc: "21:8", text: "return", kind: Keyword }
- { loc: "21:15", text: "false", kind: Keyword }
- { loc: "22:4", text: "if", kind: Keyword }
- { loc: "22:7", text: "x", kind: Parameter }
- { loc: "22:11", text: "y", kind: Parameter }
- { loc: "22:15", text: "z", kind: Parameter }
- { loc: "22:19", text: "100", kind: Number }
- { loc: "23:8", text: "return", kind: Keyword }
- { loc: "23:15", text: "false", kind: Keyword }
- { loc: "24:4", text: "return", kind: Keyword }
- { loc: "24:11", text: "true", kind: Keyword }
- { loc: "27:0", text: "// if with compound statement and multiple effects", kind: Comment }
- { loc: "28:0", text: "int", kind: Keyword }
- { loc: "28:4", text: "process", kind: Function, modifiers: [Definition] }
- { loc: "28:12", text: "int", kind: Keyword }
- { loc: "28:17", text: "data", kind: Parameter, modifiers: [Definition] }
- { loc: "28:23", text: "int", kind: Keyword }
- { loc: "28:27", text: "size", kind: Parameter, modifiers: [Definition] }
- { loc: "29:4", text: "int", kind: Keyword }
- { loc: "29:8", text: "sum", kind: Variable, modifiers: [Definition] }
- { loc: "29:14", text: "0", kind: Number }
- { loc: "30:4", text: "for", kind: Keyword }
- { loc: "30:8", text: "int", kind: Keyword }
- { loc: "30:12", text: "i", kind: Variable, modifiers: [Definition] }
- { loc: "30:16", text: "0", kind: Number }
- { loc: "30:19", text: "i", kind: Variable }
- { loc: "30:23", text: "size", kind: Parameter }
- { loc: "30:31", text: "i", kind: Variable }
- { loc: "31:8", text: "if", kind: Keyword }
- { loc: "31:11", text: "data", kind: Parameter }
- { loc: "31:16", text: "i", kind: Variable }
- { loc: "31:21", text: "0", kind: Number }
- { loc: "32:12", text: "sum", kind: Variable }
- { loc: "32:19", text: "data", kind: Parameter }
- { loc: "32:24", text: "i", kind: Variable }
- { loc: "33:12", text: "data", kind: Parameter }
- { loc: "33:17", text: "i", kind: Variable }
- { loc: "33:22", text: "0", kind: Number }
- { loc: "34:10", text: "else", kind: Keyword }
- { loc: "34:15", text: "if", kind: Keyword }
- { loc: "34:18", text: "data", kind: Parameter }
- { loc: "34:23", text: "i", kind: Variable }
- { loc: "34:29", text: "10", kind: Number }
- { loc: "35:12", text: "sum", kind: Variable }
- { loc: "35:19", text: "data", kind: Parameter }
- { loc: "35:24", text: "i", kind: Variable }
- { loc: "38:4", text: "return", kind: Keyword }
- { loc: "38:11", text: "sum", kind: Variable }
- { loc: "41:0", text: "void", kind: Keyword }
- { loc: "41:5", text: "test", kind: Function, modifiers: [Definition] }
- { loc: "42:21", text: "int", kind: Keyword }
- { loc: "42:25", text: "r1", kind: Variable, modifiers: [Definition] }
- { loc: "42:30", text: "classify_char", kind: Function }
- { loc: "42:44", text: "'a'", kind: Character }
- { loc: "43:21", text: "bool", kind: Keyword }
- { loc: "43:26", text: "r2", kind: Variable, modifiers: [Definition] }
- { loc: "43:31", text: "validate", kind: Function }
- { loc: "43:40", text: "1", kind: Number }
- { loc: "43:43", text: "2", kind: Number }
- { loc: "43:46", text: "3", kind: Number }
- { loc: "44:4", text: "int", kind: Keyword }
- { loc: "44:8", text: "arr", kind: Variable, modifiers: [Definition] }
- { loc: "44:17", text: "1", kind: Number }
- { loc: "44:21", text: "20", kind: Number }
- { loc: "44:25", text: "3", kind: Number }
- { loc: "44:29", text: "5", kind: Number }
- { loc: "45:21", text: "int", kind: Keyword }
- { loc: "45:25", text: "r3", kind: Variable, modifiers: [Definition] }
- { loc: "45:30", text: "process", kind: Function }
- { loc: "45:38", text: "arr", kind: Variable }
- { loc: "45:43", text: "4", kind: Number }
- { loc: "48:3", text: "// namespace if_chain", kind: Comment }

View File

@@ -0,0 +1,92 @@
---
source: semantic_tokens_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_consteval.cpp
---
- { loc: "0:0", text: "// C++23 if consteval", kind: Comment }
- { loc: "1:0", text: "namespace", kind: Keyword }
- { loc: "1:10", text: "if_consteval", kind: Namespace, modifiers: [Definition] }
- { loc: "3:0", text: "constexpr", kind: Keyword }
- { loc: "3:10", text: "int", kind: Keyword }
- { loc: "3:14", text: "compute", kind: Function, modifiers: [Definition] }
- { loc: "3:22", text: "int", kind: Keyword }
- { loc: "3:26", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "4:4", text: "if", kind: Keyword }
- { loc: "4:7", text: "consteval", kind: Keyword }
- { loc: "5:8", text: "return", kind: Keyword }
- { loc: "5:15", text: "x", kind: Parameter }
- { loc: "5:19", text: "x", kind: Parameter }
- { loc: "5:23", text: "// compile-time path", kind: Comment }
- { loc: "6:6", text: "else", kind: Keyword }
- { loc: "7:8", text: "return", kind: Keyword }
- { loc: "7:15", text: "x", kind: Parameter }
- { loc: "7:19", text: "x", kind: Parameter }
- { loc: "7:23", text: "// runtime path", kind: Comment }
- { loc: "11:0", text: "// negated form: if !consteval", kind: Comment }
- { loc: "12:0", text: "constexpr", kind: Keyword }
- { loc: "12:10", text: "int", kind: Keyword }
- { loc: "12:14", text: "runtime_prefer", kind: Function, modifiers: [Definition] }
- { loc: "12:29", text: "int", kind: Keyword }
- { loc: "12:33", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "13:4", text: "if", kind: Keyword }
- { loc: "13:8", text: "consteval", kind: Keyword }
- { loc: "14:8", text: "return", kind: Keyword }
- { loc: "14:15", text: "x", kind: Parameter }
- { loc: "14:19", text: "1", kind: Number }
- { loc: "14:23", text: "// runtime path", kind: Comment }
- { loc: "15:6", text: "else", kind: Keyword }
- { loc: "16:8", text: "return", kind: Keyword }
- { loc: "16:15", text: "x", kind: Parameter }
- { loc: "16:19", text: "1", kind: Number }
- { loc: "16:23", text: "// compile-time path", kind: Comment }
- { loc: "20:0", text: "// consteval function callable only at compile time", kind: Comment }
- { loc: "21:0", text: "consteval", kind: Keyword }
- { loc: "21:10", text: "int", kind: Keyword }
- { loc: "21:14", text: "ct_only", kind: Function, modifiers: [Definition] }
- { loc: "21:22", text: "int", kind: Keyword }
- { loc: "21:26", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "22:4", text: "return", kind: Keyword }
- { loc: "22:11", text: "x", kind: Parameter }
- { loc: "22:15", text: "3", kind: Number }
- { loc: "25:0", text: "constexpr", kind: Keyword }
- { loc: "25:10", text: "int", kind: Keyword }
- { loc: "25:14", text: "dispatch", kind: Function, modifiers: [Definition] }
- { loc: "25:23", text: "int", kind: Keyword }
- { loc: "25:27", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "26:4", text: "if", kind: Keyword }
- { loc: "26:7", text: "consteval", kind: Keyword }
- { loc: "27:8", text: "return", kind: Keyword }
- { loc: "27:15", text: "ct_only", kind: Function }
- { loc: "27:23", text: "x", kind: Parameter }
- { loc: "27:28", text: "// OK: in immediate context", kind: Comment }
- { loc: "28:6", text: "else", kind: Keyword }
- { loc: "29:8", text: "return", kind: Keyword }
- { loc: "29:15", text: "x", kind: Parameter }
- { loc: "33:0", text: "// if consteval without else", kind: Comment }
- { loc: "34:0", text: "constexpr", kind: Keyword }
- { loc: "34:10", text: "int", kind: Keyword }
- { loc: "34:14", text: "maybe_optimize", kind: Function, modifiers: [Definition] }
- { loc: "34:29", text: "int", kind: Keyword }
- { loc: "34:33", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "35:4", text: "if", kind: Keyword }
- { loc: "35:7", text: "consteval", kind: Keyword }
- { loc: "36:8", text: "return", kind: Keyword }
- { loc: "36:15", text: "x", kind: Parameter }
- { loc: "36:19", text: "x", kind: Parameter }
- { loc: "36:23", text: "x", kind: Parameter }
- { loc: "38:4", text: "return", kind: Keyword }
- { loc: "38:11", text: "x", kind: Parameter }
- { loc: "41:0", text: "static_assert", kind: Keyword }
- { loc: "41:14", text: "compute", kind: Function }
- { loc: "41:22", text: "5", kind: Number }
- { loc: "41:28", text: "25", kind: Number }
- { loc: "42:0", text: "static_assert", kind: Keyword }
- { loc: "42:14", text: "dispatch", kind: Function }
- { loc: "42:23", text: "3", kind: Number }
- { loc: "42:29", text: "9", kind: Number }
- { loc: "43:0", text: "static_assert", kind: Keyword }
- { loc: "43:14", text: "maybe_optimize", kind: Function }
- { loc: "43:29", text: "4", kind: Number }
- { loc: "43:35", text: "64", kind: Number }
- { loc: "45:3", text: "// namespace if_consteval", kind: Comment }

View File

@@ -0,0 +1,90 @@
---
source: semantic_tokens_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_basic.cpp
---
- { loc: "0:0", text: "// if constexpr: basic compile-time branching", kind: Comment }
- { loc: "1:0", text: "namespace", kind: Keyword }
- { loc: "1:10", text: "if_constexpr_basic", kind: Namespace, modifiers: [Definition] }
- { loc: "3:0", text: "template", kind: Keyword }
- { loc: "3:10", text: "typename", kind: Keyword }
- { loc: "3:19", text: "T", kind: Type, modifiers: [Definition] }
- { loc: "4:0", text: "constexpr", kind: Keyword }
- { loc: "4:10", text: "int", kind: Keyword }
- { loc: "4:14", text: "type_rank", kind: Function, modifiers: [Definition, Templated] }
- { loc: "5:4", text: "if", kind: Keyword }
- { loc: "5:7", text: "constexpr", kind: Keyword }
- { loc: "5:17", text: "__is_same", kind: Keyword }
- { loc: "5:27", text: "T", kind: Type }
- { loc: "5:30", text: "char", kind: Keyword }
- { loc: "6:8", text: "return", kind: Keyword }
- { loc: "6:15", text: "1", kind: Number }
- { loc: "7:6", text: "else", kind: Keyword }
- { loc: "7:11", text: "if", kind: Keyword }
- { loc: "7:14", text: "constexpr", kind: Keyword }
- { loc: "7:24", text: "__is_same", kind: Keyword }
- { loc: "7:34", text: "T", kind: Type }
- { loc: "7:37", text: "int", kind: Keyword }
- { loc: "8:8", text: "return", kind: Keyword }
- { loc: "8:15", text: "2", kind: Number }
- { loc: "9:6", text: "else", kind: Keyword }
- { loc: "9:11", text: "if", kind: Keyword }
- { loc: "9:14", text: "constexpr", kind: Keyword }
- { loc: "9:24", text: "__is_same", kind: Keyword }
- { loc: "9:34", text: "T", kind: Type }
- { loc: "9:37", text: "long", kind: Keyword }
- { loc: "9:42", text: "long", kind: Keyword }
- { loc: "10:8", text: "return", kind: Keyword }
- { loc: "10:15", text: "3", kind: Number }
- { loc: "11:6", text: "else", kind: Keyword }
- { loc: "12:8", text: "return", kind: Keyword }
- { loc: "12:15", text: "0", kind: Number }
- { loc: "16:0", text: "static_assert", kind: Keyword }
- { loc: "16:14", text: "type_rank", kind: Function }
- { loc: "16:24", text: "char", kind: Keyword }
- { loc: "16:35", text: "1", kind: Number }
- { loc: "17:0", text: "static_assert", kind: Keyword }
- { loc: "17:14", text: "type_rank", kind: Function }
- { loc: "17:24", text: "int", kind: Keyword }
- { loc: "17:34", text: "2", kind: Number }
- { loc: "18:0", text: "static_assert", kind: Keyword }
- { loc: "18:14", text: "type_rank", kind: Function }
- { loc: "18:24", text: "long", kind: Keyword }
- { loc: "18:29", text: "long", kind: Keyword }
- { loc: "18:40", text: "3", kind: Number }
- { loc: "19:0", text: "static_assert", kind: Keyword }
- { loc: "19:14", text: "type_rank", kind: Function }
- { loc: "19:24", text: "float", kind: Keyword }
- { loc: "19:36", text: "0", kind: Number }
- { loc: "21:0", text: "// discarded branch not instantiated", kind: Comment }
- { loc: "22:0", text: "template", kind: Keyword }
- { loc: "22:10", text: "typename", kind: Keyword }
- { loc: "22:19", text: "T", kind: Type, modifiers: [Definition] }
- { loc: "23:0", text: "auto", kind: Keyword }
- { loc: "23:5", text: "dereference", kind: Function, modifiers: [Definition, Templated] }
- { loc: "23:17", text: "T", kind: Type }
- { loc: "23:19", text: "val", kind: Parameter, modifiers: [Definition] }
- { loc: "24:4", text: "if", kind: Keyword }
- { loc: "24:7", text: "constexpr", kind: Keyword }
- { loc: "24:17", text: "__is_pointer", kind: Keyword }
- { loc: "24:30", text: "T", kind: Type }
- { loc: "25:8", text: "return", kind: Keyword }
- { loc: "25:16", text: "val", kind: Parameter }
- { loc: "26:6", text: "else", kind: Keyword }
- { loc: "27:8", text: "return", kind: Keyword }
- { loc: "27:15", text: "val", kind: Parameter }
- { loc: "31:0", text: "void", kind: Keyword }
- { loc: "31:5", text: "test", kind: Function, modifiers: [Definition] }
- { loc: "32:4", text: "int", kind: Keyword }
- { loc: "32:8", text: "x", kind: Variable, modifiers: [Definition] }
- { loc: "32:12", text: "42", kind: Number }
- { loc: "33:21", text: "int", kind: Keyword }
- { loc: "33:25", text: "r1", kind: Variable, modifiers: [Definition] }
- { loc: "33:30", text: "dereference", kind: Function }
- { loc: "33:43", text: "x", kind: Variable }
- { loc: "34:21", text: "int", kind: Keyword }
- { loc: "34:25", text: "r2", kind: Variable, modifiers: [Definition] }
- { loc: "34:30", text: "dereference", kind: Function }
- { loc: "34:42", text: "x", kind: Variable }
- { loc: "37:3", text: "// namespace if_constexpr_basic", kind: Comment }

View File

@@ -0,0 +1,69 @@
---
source: semantic_tokens_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_requires.cpp
---
- { loc: "0:0", text: "// if constexpr with requires-expression", kind: Comment }
- { loc: "1:0", text: "namespace", kind: Keyword }
- { loc: "1:10", text: "if_constexpr_requires", kind: Namespace, modifiers: [Definition] }
- { loc: "3:0", text: "template", kind: Keyword }
- { loc: "3:10", text: "typename", kind: Keyword }
- { loc: "3:19", text: "T", kind: Type, modifiers: [Definition] }
- { loc: "4:0", text: "int", kind: Keyword }
- { loc: "4:4", text: "get_length", kind: Function, modifiers: [Definition, Templated] }
- { loc: "4:15", text: "const", kind: Keyword }
- { loc: "4:21", text: "T", kind: Type }
- { loc: "4:24", text: "x", kind: Parameter, modifiers: [Definition, Readonly] }
- { loc: "5:4", text: "if", kind: Keyword }
- { loc: "5:7", text: "constexpr", kind: Keyword }
- { loc: "5:17", text: "requires", kind: Keyword }
- { loc: "5:28", text: "x", kind: Parameter, modifiers: [Readonly] }
- { loc: "6:8", text: "return", kind: Keyword }
- { loc: "6:15", text: "static_cast", kind: Keyword }
- { loc: "6:27", text: "int", kind: Keyword }
- { loc: "6:32", text: "x", kind: Parameter, modifiers: [Readonly] }
- { loc: "7:6", text: "else", kind: Keyword }
- { loc: "7:11", text: "if", kind: Keyword }
- { loc: "7:14", text: "constexpr", kind: Keyword }
- { loc: "7:24", text: "requires", kind: Keyword }
- { loc: "7:35", text: "x", kind: Parameter, modifiers: [Readonly] }
- { loc: "8:8", text: "return", kind: Keyword }
- { loc: "8:15", text: "x", kind: Parameter, modifiers: [Readonly] }
- { loc: "9:6", text: "else", kind: Keyword }
- { loc: "10:8", text: "return", kind: Keyword }
- { loc: "10:15", text: "1", kind: Number }
- { loc: "14:0", text: "struct", kind: Keyword }
- { loc: "14:7", text: "WithLength", kind: Struct, modifiers: [Definition] }
- { loc: "15:4", text: "int", kind: Keyword }
- { loc: "15:8", text: "length", kind: Field, modifiers: [Definition] }
- { loc: "18:0", text: "struct", kind: Keyword }
- { loc: "18:7", text: "Container", kind: Struct, modifiers: [Definition] }
- { loc: "19:4", text: "int", kind: Keyword }
- { loc: "19:8", text: "data", kind: Field, modifiers: [Definition] }
- { loc: "19:13", text: "4", kind: Number }
- { loc: "21:4", text: "int", kind: Keyword }
- { loc: "21:8", text: "size", kind: Method, modifiers: [Definition, Readonly] }
- { loc: "21:15", text: "const", kind: Keyword }
- { loc: "22:8", text: "return", kind: Keyword }
- { loc: "22:15", text: "4", kind: Number }
- { loc: "26:0", text: "void", kind: Keyword }
- { loc: "26:5", text: "test", kind: Function, modifiers: [Definition] }
- { loc: "27:4", text: "Container", kind: Struct }
- { loc: "27:14", text: "c", kind: Variable, modifiers: [Definition] }
- { loc: "28:21", text: "int", kind: Keyword }
- { loc: "28:25", text: "r1", kind: Variable, modifiers: [Definition] }
- { loc: "28:30", text: "get_length", kind: Function }
- { loc: "28:41", text: "c", kind: Variable }
- { loc: "30:4", text: "WithLength", kind: Struct }
- { loc: "30:15", text: "wl", kind: Variable, modifiers: [Definition] }
- { loc: "30:18", text: "10", kind: Number }
- { loc: "31:21", text: "int", kind: Keyword }
- { loc: "31:25", text: "r2", kind: Variable, modifiers: [Definition] }
- { loc: "31:30", text: "get_length", kind: Function }
- { loc: "31:41", text: "wl", kind: Variable }
- { loc: "33:21", text: "int", kind: Keyword }
- { loc: "33:25", text: "r3", kind: Variable, modifiers: [Definition] }
- { loc: "33:30", text: "get_length", kind: Function }
- { loc: "33:41", text: "42", kind: Number }
- { loc: "36:3", text: "// namespace if_constexpr_requires", kind: Comment }

View File

@@ -0,0 +1,82 @@
---
source: semantic_tokens_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_variadic.cpp
---
- { loc: "0:0", text: "// if constexpr with variadic templates", kind: Comment }
- { loc: "1:0", text: "namespace", kind: Keyword }
- { loc: "1:10", text: "if_constexpr_variadic", kind: Namespace, modifiers: [Definition] }
- { loc: "3:0", text: "// recursive fold with if constexpr", kind: Comment }
- { loc: "4:0", text: "template", kind: Keyword }
- { loc: "4:10", text: "typename", kind: Keyword }
- { loc: "4:19", text: "T", kind: Type, modifiers: [Definition] }
- { loc: "4:22", text: "typename", kind: Keyword }
- { loc: "4:34", text: "Rest", kind: Type, modifiers: [Definition] }
- { loc: "5:0", text: "constexpr", kind: Keyword }
- { loc: "5:10", text: "T", kind: Type }
- { loc: "5:12", text: "sum", kind: Function, modifiers: [Definition, Templated] }
- { loc: "5:16", text: "T", kind: Type }
- { loc: "5:18", text: "first", kind: Parameter, modifiers: [Definition] }
- { loc: "5:25", text: "Rest", kind: Type }
- { loc: "5:33", text: "rest", kind: Parameter, modifiers: [Definition] }
- { loc: "6:4", text: "if", kind: Keyword }
- { loc: "6:7", text: "constexpr", kind: Keyword }
- { loc: "6:17", text: "sizeof", kind: Keyword }
- { loc: "6:36", text: "0", kind: Number }
- { loc: "7:8", text: "return", kind: Keyword }
- { loc: "7:15", text: "first", kind: Parameter }
- { loc: "8:6", text: "else", kind: Keyword }
- { loc: "9:8", text: "return", kind: Keyword }
- { loc: "9:15", text: "first", kind: Parameter }
- { loc: "9:27", text: "rest", kind: Parameter }
- { loc: "13:0", text: "static_assert", kind: Keyword }
- { loc: "13:14", text: "sum", kind: Function }
- { loc: "13:18", text: "1", kind: Number }
- { loc: "13:24", text: "1", kind: Number }
- { loc: "14:0", text: "static_assert", kind: Keyword }
- { loc: "14:14", text: "sum", kind: Function }
- { loc: "14:18", text: "1", kind: Number }
- { loc: "14:21", text: "2", kind: Number }
- { loc: "14:24", text: "3", kind: Number }
- { loc: "14:30", text: "6", kind: Number }
- { loc: "15:0", text: "static_assert", kind: Keyword }
- { loc: "15:14", text: "sum", kind: Function }
- { loc: "15:18", text: "1", kind: Number }
- { loc: "15:21", text: "2", kind: Number }
- { loc: "15:24", text: "3", kind: Number }
- { loc: "15:27", text: "4", kind: Number }
- { loc: "15:30", text: "5", kind: Number }
- { loc: "15:36", text: "15", kind: Number }
- { loc: "17:0", text: "// process each element differently", kind: Comment }
- { loc: "18:0", text: "template", kind: Keyword }
- { loc: "18:10", text: "typename", kind: Keyword }
- { loc: "18:19", text: "T", kind: Type, modifiers: [Definition] }
- { loc: "19:0", text: "constexpr", kind: Keyword }
- { loc: "19:10", text: "int", kind: Keyword }
- { loc: "19:14", text: "count_one", kind: Function, modifiers: [Definition, Templated] }
- { loc: "20:4", text: "if", kind: Keyword }
- { loc: "20:7", text: "constexpr", kind: Keyword }
- { loc: "20:17", text: "__is_integral", kind: Keyword }
- { loc: "20:31", text: "T", kind: Type }
- { loc: "21:8", text: "return", kind: Keyword }
- { loc: "21:15", text: "1", kind: Number }
- { loc: "22:6", text: "else", kind: Keyword }
- { loc: "23:8", text: "return", kind: Keyword }
- { loc: "23:15", text: "0", kind: Number }
- { loc: "27:0", text: "template", kind: Keyword }
- { loc: "27:10", text: "typename", kind: Keyword }
- { loc: "27:22", text: "Ts", kind: Type, modifiers: [Definition] }
- { loc: "28:0", text: "constexpr", kind: Keyword }
- { loc: "28:10", text: "int", kind: Keyword }
- { loc: "28:14", text: "count_integrals", kind: Function, modifiers: [Definition, Templated] }
- { loc: "29:4", text: "return", kind: Keyword }
- { loc: "29:22", text: "Ts", kind: Type }
- { loc: "32:0", text: "static_assert", kind: Keyword }
- { loc: "32:14", text: "count_integrals", kind: Function }
- { loc: "32:30", text: "int", kind: Keyword }
- { loc: "32:35", text: "float", kind: Keyword }
- { loc: "32:42", text: "char", kind: Keyword }
- { loc: "32:48", text: "double", kind: Keyword }
- { loc: "32:61", text: "2", kind: Number }
- { loc: "34:3", text: "// namespace if_constexpr_variadic", kind: Comment }

View File

@@ -0,0 +1,91 @@
---
source: semantic_tokens_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_declaration_condition.cpp
---
- { loc: "0:0", text: "// if with declaration as condition", kind: Comment }
- { loc: "1:0", text: "namespace", kind: Keyword }
- { loc: "1:10", text: "if_declaration", kind: Namespace, modifiers: [Definition] }
- { loc: "3:0", text: "struct", kind: Keyword }
- { loc: "3:7", text: "Optional", kind: Struct, modifiers: [Definition] }
- { loc: "4:4", text: "int", kind: Keyword }
- { loc: "4:8", text: "value", kind: Field, modifiers: [Definition] }
- { loc: "5:4", text: "bool", kind: Keyword }
- { loc: "5:9", text: "valid", kind: Field, modifiers: [Definition] }
- { loc: "7:4", text: "explicit", kind: Keyword }
- { loc: "7:13", text: "operator", kind: Conflict, modifiers: [Definition, Readonly] }
- { loc: "7:22", text: "bool", kind: Keyword }
- { loc: "7:29", text: "const", kind: Keyword }
- { loc: "8:8", text: "return", kind: Keyword }
- { loc: "8:15", text: "valid", kind: Field }
- { loc: "12:0", text: "Optional", kind: Struct }
- { loc: "12:9", text: "try_parse", kind: Function, modifiers: [Definition] }
- { loc: "12:19", text: "int", kind: Keyword }
- { loc: "12:23", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "13:4", text: "if", kind: Keyword }
- { loc: "13:7", text: "x", kind: Parameter }
- { loc: "13:12", text: "0", kind: Number }
- { loc: "14:8", text: "return", kind: Keyword }
- { loc: "14:16", text: "x", kind: Parameter }
- { loc: "14:20", text: "2", kind: Number }
- { loc: "14:23", text: "true", kind: Keyword }
- { loc: "15:4", text: "return", kind: Keyword }
- { loc: "15:12", text: "0", kind: Number }
- { loc: "15:15", text: "false", kind: Keyword }
- { loc: "18:0", text: "int", kind: Keyword }
- { loc: "18:4", text: "use_declaration_condition", kind: Function, modifiers: [Definition] }
- { loc: "18:30", text: "int", kind: Keyword }
- { loc: "18:34", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "19:4", text: "if", kind: Keyword }
- { loc: "19:7", text: "Optional", kind: Struct }
- { loc: "19:16", text: "result", kind: Conflict, modifiers: [Definition] }
- { loc: "19:25", text: "try_parse", kind: Function }
- { loc: "19:35", text: "x", kind: Parameter }
- { loc: "20:8", text: "return", kind: Keyword }
- { loc: "20:15", text: "result", kind: Variable }
- { loc: "20:22", text: "value", kind: Field }
- { loc: "22:4", text: "return", kind: Keyword }
- { loc: "22:12", text: "1", kind: Number }
- { loc: "25:0", text: "// pointer declaration as condition", kind: Comment }
- { loc: "26:0", text: "struct", kind: Keyword }
- { loc: "26:7", text: "Node", kind: Struct, modifiers: [Definition] }
- { loc: "27:4", text: "int", kind: Keyword }
- { loc: "27:8", text: "data", kind: Field, modifiers: [Definition] }
- { loc: "28:4", text: "Node", kind: Struct }
- { loc: "28:10", text: "next", kind: Field, modifiers: [Definition] }
- { loc: "31:0", text: "int", kind: Keyword }
- { loc: "31:4", text: "walk_list", kind: Function, modifiers: [Definition] }
- { loc: "31:14", text: "Node", kind: Struct }
- { loc: "31:20", text: "head", kind: Parameter, modifiers: [Definition] }
- { loc: "32:4", text: "int", kind: Keyword }
- { loc: "32:8", text: "sum", kind: Variable, modifiers: [Definition] }
- { loc: "32:14", text: "0", kind: Number }
- { loc: "33:4", text: "if", kind: Keyword }
- { loc: "33:7", text: "Node", kind: Struct }
- { loc: "33:13", text: "p", kind: Conflict }
- { loc: "33:17", text: "head", kind: Parameter }
- { loc: "34:8", text: "sum", kind: Variable }
- { loc: "34:15", text: "p", kind: Variable }
- { loc: "34:18", text: "data", kind: Field }
- { loc: "36:4", text: "return", kind: Keyword }
- { loc: "36:11", text: "sum", kind: Variable }
- { loc: "39:0", text: "void", kind: Keyword }
- { loc: "39:5", text: "test", kind: Function, modifiers: [Definition] }
- { loc: "40:21", text: "int", kind: Keyword }
- { loc: "40:25", text: "r1", kind: Variable, modifiers: [Definition] }
- { loc: "40:30", text: "use_declaration_condition", kind: Function }
- { loc: "40:56", text: "5", kind: Number }
- { loc: "41:21", text: "int", kind: Keyword }
- { loc: "41:25", text: "r2", kind: Variable, modifiers: [Definition] }
- { loc: "41:30", text: "use_declaration_condition", kind: Function }
- { loc: "41:57", text: "1", kind: Number }
- { loc: "42:4", text: "Node", kind: Struct }
- { loc: "42:9", text: "n", kind: Variable, modifiers: [Definition] }
- { loc: "42:11", text: "42", kind: Number }
- { loc: "42:15", text: "nullptr", kind: Keyword }
- { loc: "43:21", text: "int", kind: Keyword }
- { loc: "43:25", text: "r3", kind: Variable, modifiers: [Definition] }
- { loc: "43:30", text: "walk_list", kind: Function }
- { loc: "43:41", text: "n", kind: Variable }
- { loc: "46:3", text: "// namespace if_declaration", kind: Comment }

View File

@@ -0,0 +1,105 @@
---
source: semantic_tokens_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_statement.cpp
---
- { loc: "0:0", text: "// C++17 if with init-statement", kind: Comment }
- { loc: "1:0", text: "namespace", kind: Keyword }
- { loc: "1:10", text: "if_init", kind: Namespace, modifiers: [Definition] }
- { loc: "3:0", text: "struct", kind: Keyword }
- { loc: "3:7", text: "Result", kind: Struct, modifiers: [Definition] }
- { loc: "4:4", text: "int", kind: Keyword }
- { loc: "4:8", text: "value", kind: Field, modifiers: [Definition] }
- { loc: "5:4", text: "bool", kind: Keyword }
- { loc: "5:9", text: "ok", kind: Field, modifiers: [Definition] }
- { loc: "8:0", text: "Result", kind: Struct }
- { loc: "8:7", text: "compute", kind: Function, modifiers: [Definition] }
- { loc: "8:15", text: "int", kind: Keyword }
- { loc: "8:19", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "9:4", text: "if", kind: Keyword }
- { loc: "9:7", text: "x", kind: Parameter }
- { loc: "9:11", text: "0", kind: Number }
- { loc: "10:8", text: "return", kind: Keyword }
- { loc: "10:16", text: "x", kind: Parameter }
- { loc: "10:20", text: "10", kind: Number }
- { loc: "10:24", text: "true", kind: Keyword }
- { loc: "11:4", text: "return", kind: Keyword }
- { loc: "11:12", text: "0", kind: Number }
- { loc: "11:15", text: "false", kind: Keyword }
- { loc: "14:0", text: "int", kind: Keyword }
- { loc: "14:4", text: "with_init", kind: Function, modifiers: [Definition] }
- { loc: "14:14", text: "int", kind: Keyword }
- { loc: "14:18", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "15:4", text: "if", kind: Keyword }
- { loc: "15:7", text: "auto", kind: Keyword }
- { loc: "15:12", text: "r", kind: Variable, modifiers: [Definition] }
- { loc: "15:16", text: "compute", kind: Function }
- { loc: "15:24", text: "x", kind: Parameter }
- { loc: "15:28", text: "r", kind: Variable }
- { loc: "15:30", text: "ok", kind: Field }
- { loc: "16:8", text: "return", kind: Keyword }
- { loc: "16:15", text: "r", kind: Variable }
- { loc: "16:17", text: "value", kind: Field }
- { loc: "18:4", text: "return", kind: Keyword }
- { loc: "18:12", text: "1", kind: Number }
- { loc: "21:0", text: "// init-statement with array", kind: Comment }
- { loc: "22:0", text: "bool", kind: Keyword }
- { loc: "22:5", text: "find_char", kind: Function, modifiers: [Definition] }
- { loc: "22:15", text: "const", kind: Keyword }
- { loc: "22:21", text: "char", kind: Keyword }
- { loc: "22:27", text: "str", kind: Parameter, modifiers: [Definition, Readonly] }
- { loc: "22:32", text: "char", kind: Keyword }
- { loc: "22:37", text: "target", kind: Parameter, modifiers: [Definition] }
- { loc: "23:4", text: "if", kind: Keyword }
- { loc: "23:7", text: "int", kind: Keyword }
- { loc: "23:11", text: "i", kind: Variable, modifiers: [Definition] }
- { loc: "23:15", text: "0", kind: Number }
- { loc: "23:18", text: "str", kind: Parameter, modifiers: [Readonly] }
- { loc: "24:8", text: "while", kind: Keyword }
- { loc: "24:14", text: "str", kind: Parameter, modifiers: [Readonly] }
- { loc: "24:18", text: "i", kind: Variable }
- { loc: "25:12", text: "if", kind: Keyword }
- { loc: "25:15", text: "str", kind: Parameter, modifiers: [Readonly] }
- { loc: "25:19", text: "i", kind: Variable }
- { loc: "25:25", text: "target", kind: Parameter }
- { loc: "26:16", text: "return", kind: Keyword }
- { loc: "26:23", text: "true", kind: Keyword }
- { loc: "27:14", text: "i", kind: Variable }
- { loc: "30:4", text: "return", kind: Keyword }
- { loc: "30:11", text: "false", kind: Keyword }
- { loc: "33:0", text: "// init-statement scoping: variables not visible outside", kind: Comment }
- { loc: "34:0", text: "int", kind: Keyword }
- { loc: "34:4", text: "scoping_demo", kind: Function, modifiers: [Definition] }
- { loc: "34:17", text: "int", kind: Keyword }
- { loc: "34:21", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "35:4", text: "if", kind: Keyword }
- { loc: "35:7", text: "int", kind: Keyword }
- { loc: "35:11", text: "doubled", kind: Variable, modifiers: [Definition] }
- { loc: "35:21", text: "x", kind: Parameter }
- { loc: "35:25", text: "2", kind: Number }
- { loc: "35:28", text: "doubled", kind: Variable }
- { loc: "35:38", text: "10", kind: Number }
- { loc: "36:8", text: "return", kind: Keyword }
- { loc: "36:15", text: "doubled", kind: Variable }
- { loc: "37:6", text: "else", kind: Keyword }
- { loc: "38:8", text: "return", kind: Keyword }
- { loc: "38:15", text: "doubled", kind: Variable }
- { loc: "38:25", text: "1", kind: Number }
- { loc: "38:29", text: "// doubled visible in else", kind: Comment }
- { loc: "42:0", text: "void", kind: Keyword }
- { loc: "42:5", text: "test", kind: Function, modifiers: [Definition] }
- { loc: "43:21", text: "int", kind: Keyword }
- { loc: "43:25", text: "r1", kind: Variable, modifiers: [Definition] }
- { loc: "43:30", text: "with_init", kind: Function }
- { loc: "43:40", text: "5", kind: Number }
- { loc: "44:21", text: "bool", kind: Keyword }
- { loc: "44:26", text: "r2", kind: Variable, modifiers: [Definition] }
- { loc: "44:31", text: "find_char", kind: Function }
- { loc: "44:41", text: "\"hello\"", kind: String }
- { loc: "44:50", text: "'l'", kind: Character }
- { loc: "45:21", text: "int", kind: Keyword }
- { loc: "45:25", text: "r3", kind: Variable, modifiers: [Definition] }
- { loc: "45:30", text: "scoping_demo", kind: Function }
- { loc: "45:43", text: "3", kind: Number }
- { loc: "48:3", text: "// namespace if_init", kind: Comment }

View File

@@ -0,0 +1,103 @@
---
source: semantic_tokens_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_structured_binding.cpp
---
- { loc: "0:0", text: "// if with init-statement using structured bindings", kind: Comment }
- { loc: "1:0", text: "namespace", kind: Keyword }
- { loc: "1:10", text: "if_init_sb", kind: Namespace, modifiers: [Definition] }
- { loc: "3:0", text: "struct", kind: Keyword }
- { loc: "3:7", text: "Pair", kind: Struct, modifiers: [Definition] }
- { loc: "4:4", text: "int", kind: Keyword }
- { loc: "4:8", text: "first", kind: Field, modifiers: [Definition] }
- { loc: "5:4", text: "int", kind: Keyword }
- { loc: "5:8", text: "second", kind: Field, modifiers: [Definition] }
- { loc: "8:0", text: "Pair", kind: Struct }
- { loc: "8:5", text: "divide", kind: Function, modifiers: [Definition] }
- { loc: "8:12", text: "int", kind: Keyword }
- { loc: "8:16", text: "a", kind: Parameter, modifiers: [Definition] }
- { loc: "8:19", text: "int", kind: Keyword }
- { loc: "8:23", text: "b", kind: Parameter, modifiers: [Definition] }
- { loc: "9:4", text: "if", kind: Keyword }
- { loc: "9:7", text: "b", kind: Parameter }
- { loc: "9:12", text: "0", kind: Number }
- { loc: "10:8", text: "return", kind: Keyword }
- { loc: "10:16", text: "0", kind: Number }
- { loc: "10:19", text: "0", kind: Number }
- { loc: "11:4", text: "return", kind: Keyword }
- { loc: "11:12", text: "a", kind: Parameter }
- { loc: "11:16", text: "b", kind: Parameter }
- { loc: "11:19", text: "a", kind: Parameter }
- { loc: "11:23", text: "b", kind: Parameter }
- { loc: "14:0", text: "int", kind: Keyword }
- { loc: "14:4", text: "safe_divide", kind: Function, modifiers: [Definition] }
- { loc: "14:16", text: "int", kind: Keyword }
- { loc: "14:20", text: "a", kind: Parameter, modifiers: [Definition] }
- { loc: "14:23", text: "int", kind: Keyword }
- { loc: "14:27", text: "b", kind: Parameter, modifiers: [Definition] }
- { loc: "15:4", text: "if", kind: Keyword }
- { loc: "15:7", text: "auto", kind: Keyword }
- { loc: "15:12", text: "[quot", kind: Variable, modifiers: [Definition] }
- { loc: "15:19", text: "rem", kind: Variable, modifiers: [Definition] }
- { loc: "15:26", text: "divide", kind: Function }
- { loc: "15:33", text: "a", kind: Parameter }
- { loc: "15:36", text: "b", kind: Parameter }
- { loc: "15:40", text: "b", kind: Parameter }
- { loc: "15:45", text: "0", kind: Number }
- { loc: "16:8", text: "return", kind: Keyword }
- { loc: "16:15", text: "quot", kind: Variable }
- { loc: "18:4", text: "return", kind: Keyword }
- { loc: "18:12", text: "1", kind: Number }
- { loc: "21:0", text: "struct", kind: Keyword }
- { loc: "21:7", text: "ParseResult", kind: Struct, modifiers: [Definition] }
- { loc: "22:4", text: "bool", kind: Keyword }
- { loc: "22:9", text: "success", kind: Field, modifiers: [Definition] }
- { loc: "23:4", text: "int", kind: Keyword }
- { loc: "23:8", text: "value", kind: Field, modifiers: [Definition] }
- { loc: "24:4", text: "const", kind: Keyword }
- { loc: "24:10", text: "char", kind: Keyword }
- { loc: "24:16", text: "error", kind: Field, modifiers: [Definition, Readonly] }
- { loc: "27:0", text: "ParseResult", kind: Struct }
- { loc: "27:12", text: "parse", kind: Function, modifiers: [Definition] }
- { loc: "27:18", text: "int", kind: Keyword }
- { loc: "27:22", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "28:4", text: "if", kind: Keyword }
- { loc: "28:7", text: "x", kind: Parameter }
- { loc: "28:11", text: "0", kind: Number }
- { loc: "29:8", text: "return", kind: Keyword }
- { loc: "29:16", text: "false", kind: Keyword }
- { loc: "29:23", text: "0", kind: Number }
- { loc: "29:26", text: "\"negative\"", kind: String }
- { loc: "30:4", text: "return", kind: Keyword }
- { loc: "30:12", text: "true", kind: Keyword }
- { loc: "30:18", text: "x", kind: Parameter }
- { loc: "30:21", text: "nullptr", kind: Keyword }
- { loc: "33:0", text: "int", kind: Keyword }
- { loc: "33:4", text: "try_parse", kind: Function, modifiers: [Definition] }
- { loc: "33:14", text: "int", kind: Keyword }
- { loc: "33:18", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "34:4", text: "if", kind: Keyword }
- { loc: "34:7", text: "auto", kind: Keyword }
- { loc: "34:12", text: "[ok", kind: Variable, modifiers: [Definition] }
- { loc: "34:17", text: "val", kind: Variable, modifiers: [Definition] }
- { loc: "34:22", text: "err", kind: Variable, modifiers: [Definition, Readonly] }
- { loc: "34:29", text: "parse", kind: Function }
- { loc: "34:35", text: "x", kind: Parameter }
- { loc: "34:39", text: "ok", kind: Variable }
- { loc: "35:8", text: "return", kind: Keyword }
- { loc: "35:15", text: "val", kind: Variable }
- { loc: "37:4", text: "return", kind: Keyword }
- { loc: "37:11", text: "0", kind: Number }
- { loc: "40:0", text: "void", kind: Keyword }
- { loc: "40:5", text: "test", kind: Function, modifiers: [Definition] }
- { loc: "41:21", text: "int", kind: Keyword }
- { loc: "41:25", text: "r1", kind: Variable, modifiers: [Definition] }
- { loc: "41:30", text: "safe_divide", kind: Function }
- { loc: "41:42", text: "10", kind: Number }
- { loc: "41:46", text: "3", kind: Number }
- { loc: "42:21", text: "int", kind: Keyword }
- { loc: "42:25", text: "r2", kind: Variable, modifiers: [Definition] }
- { loc: "42:30", text: "try_parse", kind: Function }
- { loc: "42:40", text: "42", kind: Number }
- { loc: "45:3", text: "// namespace if_init_sb", kind: Comment }

View File

@@ -0,0 +1,70 @@
---
source: semantic_tokens_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_null_statement.cpp
---
- { loc: "0:0", text: "// if with null statement and single-statement bodies", kind: Comment }
- { loc: "1:0", text: "namespace", kind: Keyword }
- { loc: "1:10", text: "if_null", kind: Namespace, modifiers: [Definition] }
- { loc: "3:0", text: "// null init-statement in C++17 if", kind: Comment }
- { loc: "4:0", text: "int", kind: Keyword }
- { loc: "4:4", text: "with_null_init", kind: Function, modifiers: [Definition] }
- { loc: "4:19", text: "int", kind: Keyword }
- { loc: "4:23", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "5:4", text: "if", kind: Keyword }
- { loc: "5:9", text: "x", kind: Parameter }
- { loc: "5:13", text: "0", kind: Number }
- { loc: "6:8", text: "return", kind: Keyword }
- { loc: "6:15", text: "x", kind: Parameter }
- { loc: "8:4", text: "return", kind: Keyword }
- { loc: "8:11", text: "0", kind: Number }
- { loc: "11:0", text: "// single statement body (no braces)", kind: Comment }
- { loc: "12:0", text: "int", kind: Keyword }
- { loc: "12:4", text: "single_stmt", kind: Function, modifiers: [Definition] }
- { loc: "12:16", text: "int", kind: Keyword }
- { loc: "12:20", text: "x", kind: Parameter, modifiers: [Definition] }
- { loc: "13:4", text: "if", kind: Keyword }
- { loc: "13:7", text: "x", kind: Parameter }
- { loc: "13:11", text: "10", kind: Number }
- { loc: "14:8", text: "return", kind: Keyword }
- { loc: "14:15", text: "x", kind: Parameter }
- { loc: "15:4", text: "if", kind: Keyword }
- { loc: "15:7", text: "x", kind: Parameter }
- { loc: "15:11", text: "5", kind: Number }
- { loc: "16:8", text: "return", kind: Keyword }
- { loc: "16:15", text: "x", kind: Parameter }
- { loc: "16:19", text: "1", kind: Number }
- { loc: "17:4", text: "return", kind: Keyword }
- { loc: "17:11", text: "0", kind: Number }
- { loc: "20:0", text: "// scope of variable declared in if body", kind: Comment }
- { loc: "21:0", text: "void", kind: Keyword }
- { loc: "21:5", text: "scope_test", kind: Function, modifiers: [Definition] }
- { loc: "22:4", text: "if", kind: Keyword }
- { loc: "22:7", text: "true", kind: Keyword }
- { loc: "23:25", text: "int", kind: Keyword }
- { loc: "23:29", text: "x", kind: Variable, modifiers: [Definition] }
- { loc: "23:33", text: "42", kind: Number }
- { loc: "25:4", text: "// x is out of scope here", kind: Comment }
- { loc: "27:4", text: "if", kind: Keyword }
- { loc: "27:7", text: "int", kind: Keyword }
- { loc: "27:11", text: "y", kind: Variable, modifiers: [Definition] }
- { loc: "27:15", text: "10", kind: Number }
- { loc: "27:19", text: "y", kind: Variable }
- { loc: "27:23", text: "0", kind: Number }
- { loc: "28:25", text: "int", kind: Keyword }
- { loc: "28:29", text: "z", kind: Variable, modifiers: [Definition] }
- { loc: "28:33", text: "y", kind: Variable }
- { loc: "30:4", text: "// y and z are out of scope here", kind: Comment }
- { loc: "33:0", text: "void", kind: Keyword }
- { loc: "33:5", text: "test", kind: Function, modifiers: [Definition] }
- { loc: "34:21", text: "int", kind: Keyword }
- { loc: "34:25", text: "r1", kind: Variable, modifiers: [Definition] }
- { loc: "34:30", text: "with_null_init", kind: Function }
- { loc: "34:45", text: "5", kind: Number }
- { loc: "35:21", text: "int", kind: Keyword }
- { loc: "35:25", text: "r2", kind: Variable, modifiers: [Definition] }
- { loc: "35:30", text: "single_stmt", kind: Function }
- { loc: "35:42", text: "7", kind: Number }
- { loc: "36:4", text: "scope_test", kind: Function }
- { loc: "39:3", text: "// namespace if_null", kind: Comment }

View File

@@ -0,0 +1,55 @@
---
source: tu_index_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_chain_patterns.cpp
---
- { loc: "1:10", kind: Namespace, text: "if_chain", relations: [Definition] }
- { loc: "3:4", kind: Function, text: "classify_char", relations: [Definition] }
- { loc: "3:23", kind: Parameter, text: "c", relations: [Definition] }
- { loc: "4:7", kind: Parameter, text: "c", relations: [Reference] }
- { loc: "4:19", kind: Parameter, text: "c", relations: [Reference] }
- { loc: "6:12", kind: Parameter, text: "c", relations: [Reference] }
- { loc: "6:24", kind: Parameter, text: "c", relations: [Reference] }
- { loc: "8:12", kind: Parameter, text: "c", relations: [Reference] }
- { loc: "8:24", kind: Parameter, text: "c", relations: [Reference] }
- { loc: "15:5", kind: Function, text: "validate", relations: [Definition] }
- { loc: "15:18", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "15:25", kind: Parameter, text: "y", relations: [Definition] }
- { loc: "15:32", kind: Parameter, text: "z", relations: [Definition] }
- { loc: "16:7", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "18:7", kind: Parameter, text: "y", relations: [Reference] }
- { loc: "20:7", kind: Parameter, text: "z", relations: [Reference] }
- { loc: "22:7", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "22:11", kind: Parameter, text: "y", relations: [Reference] }
- { loc: "22:15", kind: Parameter, text: "z", relations: [Reference] }
- { loc: "28:4", kind: Function, text: "process", relations: [Definition] }
- { loc: "28:17", kind: Parameter, text: "data", relations: [Definition] }
- { loc: "28:27", kind: Parameter, text: "size", relations: [Definition] }
- { loc: "29:8", kind: Variable, text: "sum", relations: [Definition] }
- { loc: "30:12", kind: Variable, text: "i", relations: [Definition] }
- { loc: "30:19", kind: Variable, text: "i", relations: [Reference] }
- { loc: "30:23", kind: Parameter, text: "size", relations: [Reference] }
- { loc: "30:31", kind: Variable, text: "i", relations: [Reference] }
- { loc: "31:11", kind: Parameter, text: "data", relations: [Reference] }
- { loc: "31:16", kind: Variable, text: "i", relations: [Reference] }
- { loc: "32:12", kind: Variable, text: "sum", relations: [Reference] }
- { loc: "32:19", kind: Parameter, text: "data", relations: [Reference] }
- { loc: "32:24", kind: Variable, text: "i", relations: [Reference] }
- { loc: "33:12", kind: Parameter, text: "data", relations: [Reference] }
- { loc: "33:17", kind: Variable, text: "i", relations: [Reference] }
- { loc: "34:18", kind: Parameter, text: "data", relations: [Reference] }
- { loc: "34:23", kind: Variable, text: "i", relations: [Reference] }
- { loc: "35:12", kind: Variable, text: "sum", relations: [Reference] }
- { loc: "35:19", kind: Parameter, text: "data", relations: [Reference] }
- { loc: "35:24", kind: Variable, text: "i", relations: [Reference] }
- { loc: "38:11", kind: Variable, text: "sum", relations: [Reference] }
- { loc: "41:5", kind: Function, text: "test", relations: [Definition] }
- { loc: "42:25", kind: Variable, text: "r1", relations: [Definition] }
- { loc: "42:30", kind: Function, text: "classify_char", relations: [Reference] }
- { loc: "43:26", kind: Variable, text: "r2", relations: [Definition] }
- { loc: "43:31", kind: Function, text: "validate", relations: [Reference] }
- { loc: "44:8", kind: Variable, text: "arr", relations: [Definition] }
- { loc: "45:25", kind: Variable, text: "r3", relations: [Definition] }
- { loc: "45:30", kind: Function, text: "process", relations: [Reference] }
- { loc: "45:38", kind: Variable, text: "arr", relations: [Reference] }

View File

@@ -0,0 +1,34 @@
---
source: tu_index_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_consteval.cpp
---
- { loc: "1:10", kind: Namespace, text: "if_consteval", relations: [Definition] }
- { loc: "3:14", kind: Function, text: "compute", relations: [Definition] }
- { loc: "3:26", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "5:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "5:19", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "7:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "7:19", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "12:14", kind: Function, text: "runtime_prefer", relations: [Definition] }
- { loc: "12:33", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "14:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "16:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "21:14", kind: Function, text: "ct_only", relations: [Definition] }
- { loc: "21:26", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "22:11", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "25:14", kind: Function, text: "dispatch", relations: [Definition] }
- { loc: "25:27", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "27:15", kind: Function, text: "ct_only", relations: [Reference] }
- { loc: "27:23", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "29:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "34:14", kind: Function, text: "maybe_optimize", relations: [Definition] }
- { loc: "34:33", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "36:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "36:19", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "36:23", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "38:11", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "41:14", kind: Function, text: "compute", relations: [Reference] }
- { loc: "42:14", kind: Function, text: "dispatch", relations: [Reference] }
- { loc: "43:14", kind: Function, text: "maybe_optimize", relations: [Reference] }

View File

@@ -0,0 +1,31 @@
---
source: tu_index_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_basic.cpp
---
- { loc: "1:10", kind: Namespace, text: "if_constexpr_basic", relations: [Definition] }
- { loc: "3:19", kind: Type, text: "T", relations: [Definition] }
- { loc: "4:14", kind: Function, text: "type_rank", relations: [Definition] }
- { loc: "5:27", kind: Type, text: "T", relations: [Reference] }
- { loc: "7:34", kind: Type, text: "T", relations: [Reference] }
- { loc: "9:34", kind: Type, text: "T", relations: [Reference] }
- { loc: "16:14", kind: Function, text: "type_rank", relations: [Reference] }
- { loc: "17:14", kind: Function, text: "type_rank", relations: [Reference] }
- { loc: "18:14", kind: Function, text: "type_rank", relations: [Reference] }
- { loc: "19:14", kind: Function, text: "type_rank", relations: [Reference] }
- { loc: "22:19", kind: Type, text: "T", relations: [Definition] }
- { loc: "23:5", kind: Function, text: "dereference", relations: [Definition] }
- { loc: "23:17", kind: Type, text: "T", relations: [Reference] }
- { loc: "23:19", kind: Parameter, text: "val", relations: [Definition] }
- { loc: "24:30", kind: Type, text: "T", relations: [Reference] }
- { loc: "25:16", kind: Parameter, text: "val", relations: [Reference] }
- { loc: "27:15", kind: Parameter, text: "val", relations: [Reference] }
- { loc: "31:5", kind: Function, text: "test", relations: [Definition] }
- { loc: "32:8", kind: Variable, text: "x", relations: [Definition] }
- { loc: "33:25", kind: Variable, text: "r1", relations: [Definition] }
- { loc: "33:30", kind: Function, text: "dereference", relations: [Reference] }
- { loc: "33:43", kind: Variable, text: "x", relations: [Reference] }
- { loc: "34:25", kind: Variable, text: "r2", relations: [Definition] }
- { loc: "34:30", kind: Function, text: "dereference", relations: [Reference] }
- { loc: "34:42", kind: Variable, text: "x", relations: [Reference] }

View File

@@ -0,0 +1,33 @@
---
source: tu_index_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_requires.cpp
---
- { loc: "1:10", kind: Namespace, text: "if_constexpr_requires", relations: [Definition] }
- { loc: "3:19", kind: Type, text: "T", relations: [Definition] }
- { loc: "4:4", kind: Function, text: "get_length", relations: [Definition] }
- { loc: "4:21", kind: Type, text: "T", relations: [Reference] }
- { loc: "4:24", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "5:28", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "6:32", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "7:35", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "8:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "14:7", kind: Struct, text: "WithLength", relations: [Definition] }
- { loc: "15:8", kind: Field, text: "length", relations: [Definition] }
- { loc: "18:7", kind: Struct, text: "Container", relations: [Definition] }
- { loc: "19:8", kind: Field, text: "data", relations: [Definition] }
- { loc: "21:8", kind: Method, text: "size", relations: [Definition] }
- { loc: "26:5", kind: Function, text: "test", relations: [Definition] }
- { loc: "27:4", kind: Struct, text: "Container", relations: [Reference] }
- { loc: "27:14", kind: Variable, text: "c", relations: [Definition] }
- { loc: "28:25", kind: Variable, text: "r1", relations: [Definition] }
- { loc: "28:30", kind: Function, text: "get_length", relations: [Reference] }
- { loc: "28:41", kind: Variable, text: "c", relations: [Reference] }
- { loc: "30:4", kind: Struct, text: "WithLength", relations: [Reference] }
- { loc: "30:15", kind: Variable, text: "wl", relations: [Definition] }
- { loc: "31:25", kind: Variable, text: "r2", relations: [Definition] }
- { loc: "31:30", kind: Function, text: "get_length", relations: [Reference] }
- { loc: "31:41", kind: Variable, text: "wl", relations: [Reference] }
- { loc: "33:25", kind: Variable, text: "r3", relations: [Definition] }
- { loc: "33:30", kind: Function, text: "get_length", relations: [Reference] }

View File

@@ -0,0 +1,28 @@
---
source: tu_index_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_constexpr_variadic.cpp
---
- { loc: "1:10", kind: Namespace, text: "if_constexpr_variadic", relations: [Definition] }
- { loc: "4:19", kind: Type, text: "T", relations: [Definition] }
- { loc: "4:34", kind: Type, text: "Rest", relations: [Definition] }
- { loc: "5:10", kind: Type, text: "T", relations: [Reference] }
- { loc: "5:12", kind: Function, text: "sum", relations: [Definition] }
- { loc: "5:16", kind: Type, text: "T", relations: [Reference] }
- { loc: "5:18", kind: Parameter, text: "first", relations: [Definition] }
- { loc: "5:25", kind: Type, text: "Rest", relations: [Reference] }
- { loc: "5:33", kind: Parameter, text: "rest", relations: [Definition] }
- { loc: "7:15", kind: Parameter, text: "first", relations: [Reference] }
- { loc: "9:15", kind: Parameter, text: "first", relations: [Reference] }
- { loc: "9:27", kind: Parameter, text: "rest", relations: [Reference] }
- { loc: "13:14", kind: Function, text: "sum", relations: [Reference] }
- { loc: "14:14", kind: Function, text: "sum", relations: [Reference] }
- { loc: "15:14", kind: Function, text: "sum", relations: [Reference] }
- { loc: "18:19", kind: Type, text: "T", relations: [Definition] }
- { loc: "19:14", kind: Function, text: "count_one", relations: [Definition] }
- { loc: "20:31", kind: Type, text: "T", relations: [Reference] }
- { loc: "27:22", kind: Type, text: "Ts", relations: [Definition] }
- { loc: "28:14", kind: Function, text: "count_integrals", relations: [Definition] }
- { loc: "29:22", kind: Type, text: "Ts", relations: [Reference] }
- { loc: "32:14", kind: Function, text: "count_integrals", relations: [Reference] }

View File

@@ -0,0 +1,50 @@
---
source: tu_index_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_declaration_condition.cpp
---
- { loc: "1:10", kind: Namespace, text: "if_declaration", relations: [Definition] }
- { loc: "3:7", kind: Struct, text: "Optional", relations: [Definition] }
- { loc: "4:8", kind: Field, text: "value", relations: [Definition] }
- { loc: "5:9", kind: Field, text: "valid", relations: [Definition] }
- { loc: "7:13", kind: Method, text: "operator", relations: [Definition] }
- { loc: "8:15", kind: Field, text: "valid", relations: [Reference] }
- { loc: "12:0", kind: Struct, text: "Optional", relations: [Reference] }
- { loc: "12:9", kind: Function, text: "try_parse", relations: [Definition] }
- { loc: "12:23", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "13:7", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "14:16", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "18:4", kind: Function, text: "use_declaration_condition", relations: [Definition] }
- { loc: "18:34", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "19:7", kind: Struct, text: "Optional", relations: [Reference] }
- { loc: "19:16", kind: Variable, text: "result", relations: [Definition, Reference] }
- { loc: "19:25", kind: Function, text: "try_parse", relations: [Reference] }
- { loc: "19:35", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "20:15", kind: Variable, text: "result", relations: [Reference] }
- { loc: "20:22", kind: Field, text: "value", relations: [Reference] }
- { loc: "26:7", kind: Struct, text: "Node", relations: [Definition] }
- { loc: "27:8", kind: Field, text: "data", relations: [Definition] }
- { loc: "28:4", kind: Struct, text: "Node", relations: [Reference] }
- { loc: "28:10", kind: Field, text: "next", relations: [Definition] }
- { loc: "31:4", kind: Function, text: "walk_list", relations: [Definition] }
- { loc: "31:14", kind: Struct, text: "Node", relations: [Reference] }
- { loc: "31:20", kind: Parameter, text: "head", relations: [Definition] }
- { loc: "32:8", kind: Variable, text: "sum", relations: [Definition] }
- { loc: "33:7", kind: Struct, text: "Node", relations: [Reference] }
- { loc: "33:13", kind: Variable, text: "p", relations: [Definition, Reference] }
- { loc: "33:17", kind: Parameter, text: "head", relations: [Reference] }
- { loc: "34:8", kind: Variable, text: "sum", relations: [Reference] }
- { loc: "34:15", kind: Variable, text: "p", relations: [Reference] }
- { loc: "34:18", kind: Field, text: "data", relations: [Reference] }
- { loc: "36:11", kind: Variable, text: "sum", relations: [Reference] }
- { loc: "39:5", kind: Function, text: "test", relations: [Definition] }
- { loc: "40:25", kind: Variable, text: "r1", relations: [Definition] }
- { loc: "40:30", kind: Function, text: "use_declaration_condition", relations: [Reference] }
- { loc: "41:25", kind: Variable, text: "r2", relations: [Definition] }
- { loc: "41:30", kind: Function, text: "use_declaration_condition", relations: [Reference] }
- { loc: "42:4", kind: Struct, text: "Node", relations: [Reference] }
- { loc: "42:9", kind: Variable, text: "n", relations: [Definition] }
- { loc: "43:25", kind: Variable, text: "r3", relations: [Definition] }
- { loc: "43:30", kind: Function, text: "walk_list", relations: [Reference] }
- { loc: "43:41", kind: Variable, text: "n", relations: [Reference] }

View File

@@ -0,0 +1,49 @@
---
source: tu_index_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_statement.cpp
---
- { loc: "1:10", kind: Namespace, text: "if_init", relations: [Definition] }
- { loc: "3:7", kind: Struct, text: "Result", relations: [Definition] }
- { loc: "4:8", kind: Field, text: "value", relations: [Definition] }
- { loc: "5:9", kind: Field, text: "ok", relations: [Definition] }
- { loc: "8:0", kind: Struct, text: "Result", relations: [Reference] }
- { loc: "8:7", kind: Function, text: "compute", relations: [Definition] }
- { loc: "8:19", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "9:7", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "10:16", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "14:4", kind: Function, text: "with_init", relations: [Definition] }
- { loc: "14:18", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "15:12", kind: Variable, text: "r", relations: [Definition] }
- { loc: "15:16", kind: Function, text: "compute", relations: [Reference] }
- { loc: "15:24", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "15:28", kind: Variable, text: "r", relations: [Reference] }
- { loc: "15:30", kind: Field, text: "ok", relations: [Reference] }
- { loc: "16:15", kind: Variable, text: "r", relations: [Reference] }
- { loc: "16:17", kind: Field, text: "value", relations: [Reference] }
- { loc: "22:5", kind: Function, text: "find_char", relations: [Definition] }
- { loc: "22:27", kind: Parameter, text: "str", relations: [Definition] }
- { loc: "22:37", kind: Parameter, text: "target", relations: [Definition] }
- { loc: "23:11", kind: Variable, text: "i", relations: [Definition] }
- { loc: "23:18", kind: Parameter, text: "str", relations: [Reference] }
- { loc: "24:14", kind: Parameter, text: "str", relations: [Reference] }
- { loc: "24:18", kind: Variable, text: "i", relations: [Reference] }
- { loc: "25:15", kind: Parameter, text: "str", relations: [Reference] }
- { loc: "25:19", kind: Variable, text: "i", relations: [Reference] }
- { loc: "25:25", kind: Parameter, text: "target", relations: [Reference] }
- { loc: "27:14", kind: Variable, text: "i", relations: [Reference] }
- { loc: "34:4", kind: Function, text: "scoping_demo", relations: [Definition] }
- { loc: "34:21", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "35:11", kind: Variable, text: "doubled", relations: [Definition] }
- { loc: "35:21", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "35:28", kind: Variable, text: "doubled", relations: [Reference] }
- { loc: "36:15", kind: Variable, text: "doubled", relations: [Reference] }
- { loc: "38:15", kind: Variable, text: "doubled", relations: [Reference] }
- { loc: "42:5", kind: Function, text: "test", relations: [Definition] }
- { loc: "43:25", kind: Variable, text: "r1", relations: [Definition] }
- { loc: "43:30", kind: Function, text: "with_init", relations: [Reference] }
- { loc: "44:26", kind: Variable, text: "r2", relations: [Definition] }
- { loc: "44:31", kind: Function, text: "find_char", relations: [Reference] }
- { loc: "45:25", kind: Variable, text: "r3", relations: [Definition] }
- { loc: "45:30", kind: Function, text: "scoping_demo", relations: [Reference] }

View File

@@ -0,0 +1,54 @@
---
source: tu_index_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_init_structured_binding.cpp
---
- { loc: "1:10", kind: Namespace, text: "if_init_sb", relations: [Definition] }
- { loc: "3:7", kind: Struct, text: "Pair", relations: [Definition] }
- { loc: "4:8", kind: Field, text: "first", relations: [Definition] }
- { loc: "5:8", kind: Field, text: "second", relations: [Definition] }
- { loc: "8:0", kind: Struct, text: "Pair", relations: [Reference] }
- { loc: "8:5", kind: Function, text: "divide", relations: [Definition] }
- { loc: "8:16", kind: Parameter, text: "a", relations: [Definition] }
- { loc: "8:23", kind: Parameter, text: "b", relations: [Definition] }
- { loc: "9:7", kind: Parameter, text: "b", relations: [Reference] }
- { loc: "11:12", kind: Parameter, text: "a", relations: [Reference] }
- { loc: "11:16", kind: Parameter, text: "b", relations: [Reference] }
- { loc: "11:19", kind: Parameter, text: "a", relations: [Reference] }
- { loc: "11:23", kind: Parameter, text: "b", relations: [Reference] }
- { loc: "14:4", kind: Function, text: "safe_divide", relations: [Definition] }
- { loc: "14:20", kind: Parameter, text: "a", relations: [Definition] }
- { loc: "14:27", kind: Parameter, text: "b", relations: [Definition] }
- { loc: "15:12", kind: Variable, text: "[", relations: [Definition] }
- { loc: "15:13", kind: Variable, text: "quot", relations: [Definition] }
- { loc: "15:19", kind: Variable, text: "rem", relations: [Definition] }
- { loc: "15:26", kind: Function, text: "divide", relations: [Reference] }
- { loc: "15:33", kind: Parameter, text: "a", relations: [Reference] }
- { loc: "15:36", kind: Parameter, text: "b", relations: [Reference] }
- { loc: "15:40", kind: Parameter, text: "b", relations: [Reference] }
- { loc: "16:15", kind: Variable, text: "quot", relations: [Reference] }
- { loc: "21:7", kind: Struct, text: "ParseResult", relations: [Definition] }
- { loc: "22:9", kind: Field, text: "success", relations: [Definition] }
- { loc: "23:8", kind: Field, text: "value", relations: [Definition] }
- { loc: "24:16", kind: Field, text: "error", relations: [Definition] }
- { loc: "27:0", kind: Struct, text: "ParseResult", relations: [Reference] }
- { loc: "27:12", kind: Function, text: "parse", relations: [Definition] }
- { loc: "27:22", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "28:7", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "30:18", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "33:4", kind: Function, text: "try_parse", relations: [Definition] }
- { loc: "33:18", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "34:12", kind: Variable, text: "[", relations: [Definition] }
- { loc: "34:13", kind: Variable, text: "ok", relations: [Definition] }
- { loc: "34:17", kind: Variable, text: "val", relations: [Definition] }
- { loc: "34:22", kind: Variable, text: "err", relations: [Definition] }
- { loc: "34:29", kind: Function, text: "parse", relations: [Reference] }
- { loc: "34:35", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "34:39", kind: Variable, text: "ok", relations: [Reference] }
- { loc: "35:15", kind: Variable, text: "val", relations: [Reference] }
- { loc: "40:5", kind: Function, text: "test", relations: [Definition] }
- { loc: "41:25", kind: Variable, text: "r1", relations: [Definition] }
- { loc: "41:30", kind: Function, text: "safe_divide", relations: [Reference] }
- { loc: "42:25", kind: Variable, text: "r2", relations: [Definition] }
- { loc: "42:30", kind: Function, text: "try_parse", relations: [Reference] }

View File

@@ -0,0 +1,29 @@
---
source: tu_index_tests.cpp
created_at: 2026-05-24
input_file: statements/if/if_null_statement.cpp
---
- { loc: "1:10", kind: Namespace, text: "if_null", relations: [Definition] }
- { loc: "4:4", kind: Function, text: "with_null_init", relations: [Definition] }
- { loc: "4:23", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "5:9", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "6:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "12:4", kind: Function, text: "single_stmt", relations: [Definition] }
- { loc: "12:20", kind: Parameter, text: "x", relations: [Definition] }
- { loc: "13:7", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "14:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "15:7", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "16:15", kind: Parameter, text: "x", relations: [Reference] }
- { loc: "21:5", kind: Function, text: "scope_test", relations: [Definition] }
- { loc: "23:29", kind: Variable, text: "x", relations: [Definition] }
- { loc: "27:11", kind: Variable, text: "y", relations: [Definition] }
- { loc: "27:19", kind: Variable, text: "y", relations: [Reference] }
- { loc: "28:29", kind: Variable, text: "z", relations: [Definition] }
- { loc: "28:33", kind: Variable, text: "y", relations: [Reference] }
- { loc: "33:5", kind: Function, text: "test", relations: [Definition] }
- { loc: "34:25", kind: Variable, text: "r1", relations: [Definition] }
- { loc: "34:30", kind: Function, text: "with_null_init", relations: [Reference] }
- { loc: "35:25", kind: Variable, text: "r2", relations: [Definition] }
- { loc: "35:30", kind: Function, text: "single_stmt", relations: [Reference] }
- { loc: "36:4", kind: Function, text: "scope_test", relations: [Reference] }

View File

@@ -1,6 +1,5 @@
#include "test/test.h"
#include "compile/compilation.h"
#include "compile/implement.h"
namespace clice::testing {
namespace {
@@ -8,10 +7,6 @@ namespace {
TEST_SUITE(ClangTidy) {
TEST_CASE(FastCheck) {
#ifdef CLICE_HAS_CLANG_TIDY_MODULES
ASSERT_TRUE(tidy::is_registered_tidy_check("bugprone-integer-division"));
#endif
// ASSERT_TRUE(tidy::is_fast_tidy_check("readability-misleading-indentation"));
// ASSERT_TRUE(tidy::is_fast_tidy_check("bugprone-unused-return-value"));
//
@@ -27,7 +22,6 @@ TEST_CASE(Tidy) {
std::string main_path = TestVFS::path("main.cpp");
CompilationParams params;
params.kind = CompilationKind::Content;
params.clang_tidy = true;
params.vfs = vfs;
params.arguments = {"clang++", "-ffreestanding", "-Xclang", "-undef", main_path.c_str()};
@@ -36,37 +30,6 @@ TEST_CASE(Tidy) {
ASSERT_FALSE(unit.diagnostics().empty());
}
#ifdef CLICE_HAS_CLANG_TIDY_MODULES
TEST_CASE(BugproneIntegerDivision) {
auto vfs = llvm::makeIntrusiveRefCnt<TestVFS>();
vfs->add("main.cpp",
"int main() {"
" double d;"
" int i = 42;"
" d = 32 * 8 / (2 + i);"
" return static_cast<int>(d);"
"}");
std::string main_path = TestVFS::path("main.cpp");
CompilationParams params;
params.kind = CompilationKind::Content;
params.clang_tidy = true;
params.vfs = vfs;
params.arguments = {"clang++", "-ffreestanding", "-Xclang", "-undef", main_path.c_str()};
auto unit = compile(params);
ASSERT_TRUE(unit.completed());
bool found = false;
for(auto& diagnostic: unit.diagnostics()) {
if(llvm::StringRef(diagnostic.message).contains("integer division")) {
found = true;
break;
}
}
ASSERT_TRUE(found);
}
#endif
}; // TEST_SUITE(ClangTidy)
} // namespace
} // namespace clice::testing

View File

@@ -140,10 +140,6 @@ void EXPECT_TOKEN(llvm::StringRef name,
ASSERT_EQ(token->modifiers, expected_modifiers);
}
void EXPECT_NO_TOKEN(llvm::StringRef name) {
ASSERT_TRUE(find_by_range(name) == nullptr);
}
TEST_CASE(BasicLexicalKinds) {
run_utf8(R"cpp(
@d1[#define] @m0[FOO]
@@ -270,44 +266,6 @@ int main() {
EXPECT_TOKEN("x3", SymbolKind::Variable, 0);
}
TEST_CASE(IneligibleOperatorReferenceIsSuppressed) {
run_utf8(R"cpp(
struct S {};
S operator+(S lhs, S rhs);
void use(S lhs, S rhs) {
(void)(lhs @plus[+] rhs);
}
)cpp");
EXPECT_NO_TOKEN("plus");
}
TEST_CASE(ConstructorAndDestructorNamesRemainHighlighted) {
run_utf8(R"cpp(
struct S {
@ctor_decl[S]();
@dtor_decl[~]S();
};
S::@ctor_def[S]() {}
void use(S* value) {
value->@dtor_ref[~]S();
}
)cpp");
auto declaration = modifier_mask({SymbolModifiers::Declaration});
auto definition = modifier_mask({SymbolModifiers::Definition});
auto special_member = modifier_mask({SymbolModifiers::ConstructorOrDestructor});
EXPECT_TOKEN("ctor_decl", SymbolKind::Method, declaration | special_member);
EXPECT_TOKEN("dtor_decl", SymbolKind::Method, declaration | special_member);
EXPECT_TOKEN("ctor_def", SymbolKind::Method, definition | special_member);
EXPECT_TOKEN("dtor_ref", SymbolKind::Method, special_member);
}
TEST_CASE(LegacyVarDeclTemplates) {
run_utf8(R"cpp(
extern int @x1[x];