#pragma once #include #include #include #include #include #include #include #include #include #include #include #include namespace vls::semantic { class GccProfile { public: // Only the launcher selects this file for its explicitly selected workspace. static std::expected, 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::string> prepare(const std::filesystem::path &driver); std::filesystem::path driver, frontend, bubblewrap, strace, prlimit; std::vector 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 sources; Void::LanguageServer::Build::Revision revision; // Present only when the launcher-selected observer produced a verified report. std::optional 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 lookups; std::size_t compiler_runs{}; std::optional 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 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 previous_lookups, std::stop_token stop); struct StockScan { std::vector 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 scan_modules_with_gcc(const GccProfile &profile, const SemanticContextLease &lease, const Documents::DocumentStore &documents, const SourceCatalog &catalog, const InstalledSourceGrant &grant, std::span previous_lookups, std::stop_token stop); } // namespace vls::semantic