Files
Language-Server/include/vls/semantic/StockCompiler.hpp
T
faumaray da8003f6d4 Implement the VLS roadmap on the native VBS build
Native VBS and CMake builds of the server and every registered suite:
protocol and document sync, VBS/compdb providers, stock GCC diagnostics
(including in-process default profile preparation), the stock occurrence
observer and hover/definition, the bounded Scheduler, C++ module graph,
scan and artifact cache with real CMI production, the context-aware
symbol index with schema-2 snapshot migration, navigation and guarded
rename, reflection provenance with splice-origin extraction, index-backed
completion and signature help, live GCC worker control with a registered
DAP suite, and the Neovim and VS Code clients.

VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced
from the versioned patches and verified stepping reflection/template code
with projected values 17/34 and 41/82.
2026-12-05 14:06:50 +03:00

80 lines
3.2 KiB
C++

#pragma once
#include <vls/WorkspaceSession.hpp>
#include <vls/semantic/Diagnostics.hpp>
#include <vls/semantic/Occurrences.hpp>
#include <vls/semantic/SourceCatalog.hpp>
#include <expected>
#include <filesystem>
#include <memory>
#include <optional>
#include <span>
#include <stop_token>
#include <string>
#include <vector>
namespace vls::semantic {
class GccProfile {
public:
// Only the launcher selects this file for its explicitly selected workspace.
static std::expected<std::shared_ptr<const GccProfile>, std::string>
load(const std::filesystem::path &file);
// Prepares the profile in process from the selected GCC driver. No
// external script or pre-generated JSON is required.
static std::expected<std::shared_ptr<const GccProfile>, std::string>
prepare(const std::filesystem::path &driver);
std::filesystem::path driver, frontend, bubblewrap, strace, prlimit;
std::vector<std::filesystem::path> mounts;
// Optional launcher-selected occurrence observer. Its exact bytes are
// re-verified for every job; metadata cannot select or alter it.
std::filesystem::path observer;
std::string observer_identity;
std::string target, flags, identity;
[[nodiscard]] bool observes() const noexcept { return !observer.empty(); }
private:
GccProfile() = default;
};
struct StockAnalysis {
DiagnosticBatch batch;
std::shared_ptr<const SourceCapture> sources;
Void::LanguageServer::Build::Revision revision;
// Present only when the launcher-selected observer produced a verified report.
std::optional<OccurrenceReport> occurrences;
// Why occurrence facts are unavailable when the observer was selected.
std::string occurrence_detail;
// Hints for the next run. Each new job reacquires and verifies all positive and negative
// inputs.
std::vector<std::filesystem::path> lookups;
std::size_t compiler_runs{};
std::optional<std::filesystem::path> unproven_location_origin;
};
// One job owns an isolated filesystem and runs the regular GCC frontend. Caller revalidates
// the lease and capture before delivering diagnostics to an editor.
[[nodiscard]] std::expected<StockAnalysis, std::string>
analyze_with_gcc(const GccProfile &profile, const SemanticContextLease &lease,
const Documents::DocumentStore &documents, const SourceCatalog &catalog,
const InstalledSourceGrant &grant, std::uint64_t sequence,
std::span<const std::filesystem::path> previous_lookups, std::stop_token stop);
struct StockScan {
std::vector<std::string> provides, imports;
bool complete{};
};
// Runs the checked P1689 scan for the selected translation unit in the same
// isolated compiler view. The caller owns admission and cancellation.
[[nodiscard]] std::expected<StockScan, std::string>
scan_modules_with_gcc(const GccProfile &profile, const SemanticContextLease &lease,
const Documents::DocumentStore &documents, const SourceCatalog &catalog,
const InstalledSourceGrant &grant,
std::span<const std::filesystem::path> previous_lookups,
std::stop_token stop);
} // namespace vls::semantic